As ISIS keeps advancing on the ground in Iraq, the hardline jihadi militants have revived with a vengeance one of the oldest conflicts there is: the rift between the Sunnis and Shiites in Islam.

Iraq is a perfect ground for the divide to turn violent: it has a Shia-majority population, a Shia-led government under Prime Minister Nouri al-Maliki, and an embattled Sunni minority, which dominated the country for centuries, from the Ottoman Empire until the U.S. invasion deposed Saddam Hussein in 2003.

"The Iraq conflict plays out on several levels between Sunnis and Shiites. First and foremost, it's about how to share power in a 21st century state. The prime minister, a Shiite, has failed abysmally in creating a formula to share power with the Sunnis, the traditional political masters in Iraq," Robin Wright, a joint fellow at the U.S. Institute of Peace and the Woodrow Wilson Center, non-partisan institutions, told NBC News.

The divide between the two major branches of Islam has lasted for centuries -- and the schism is not always just a religious one. It began when the Prophet Muhammad died in 632 A.D. and a clash erupted over who should succeed him. One side, which became the Shiites, believed Muhammad’s successor should be someone from his bloodline; those who spawned the Sunnis held it could be a pious individual who could follow Muhammad’s customs. The rift has divided the Muslim landscape across the Middle East and beyond for 1,350 years, with some countries being controlled by Shiites and the others by Sunnis, and shifting back and forth.

While the two sects may disagree over the politics of succession, they share many of the same beliefs. Both read the Quran as the Word of God, believe in the sayings of the Prophet and follow the Five Pillars of Islam. Their prayer rituals are nearly identical -- for instance Shiites will stand with their hands at their sides, Sunnis will put their hands on their stomachs. Both sides also believe in Islamic law, but have different ways of interpreting and enforcing it.

The large majority of the world’s Muslims are Sunni. Shiites are concentrated in Iran, southern Iraq and southern Lebanon, with significant communities in Saudi Arabia and the Persian Gulf states, Yemen, Syria, Afghanistan, Pakistan and India.

The Iranian Revolution in 1979 was a turning point in the Sunni-Shiite conflict, creating a radical Shiite theocracy in a large, oil-rich and well-armed nation. While the Ayatollah Khomeini, the revolution's inspiration and Iran's supreme leader, tried to build bridges between the two sects, other religious and secular leaders advanced the divide. Today, Iranian Sunnis do not have a mosque of their own, they do not hold top government posts, and Sunni businessmen have difficulties obtaining import and export licenses.

In Saudi Arabia, it’s the opposite. Sunnis are in power, with Shiites being the target of discrimination. Most Shia holy places in the kingdom have been destroyed by the Saudi royal family. A particularly rabid brand of local Sunni fundamentalism entwined with the state, known as Wahhabism, places severe restrictions on Shia practices, with some leaders being jailed.

While there’s a history of violence between the two groups, there were periods where they lived peacefully together for centuries. Today’s fighting in Iraq stems from a political power struggle.

There, Sunnis are a minority of the population, concentrated in the north and west. Since the end of World War I and the creation of Iraq by the British from the defeated Ottoman Empire, Sunnis have controlled Iraqi politics, often brutally. In 2003, when the U.S. invaded Iraq, Saddam Hussein’s Sunni regime was toppled and Shiites took power.

Three years later, Maliki, a Shiite allied with Iran, became the country's new leader. Rather than seeking peace between the two groups, critics say he oppressed the Sunnis both inside government and by squashing protests in the streets. Today, ISIS militants from neighboring Syria have crossed the border into Iraq and have taken advantage of the discontent among the nation’s Sunni population. After the U.S. withdrew its forces in 2011, the Iraqi army it trained -- which is itself divided along sectarian lines and is largely Shia -- proved unable to fight the Sunni militants and has in fact fled before their advance.

"Sunnis have always held power in Iraq in significant quantities," Haider Ala Hamoudi, an associate professor of law at the University of Pittsburgh School of Law, told NBC News. "Over the course of decades, through a series of revolutions, the decision to exclude Shia became much more conscious. They were feared as a group that could somehow sell the country to Iran. The exclusion of the Shia was not something that was just a historical accident, but was viewed as something that was important to preserve the state in its current form."

In other parts of the Arab world, relative peace has prevailed between the two sects. In 1959, al-Azhar University in Cairo, the world's most influential center of Sunni scholarship, admitted Shia jurisprudence to its curriculum. In Azerbaijan, where the Shias are in the majority, there are mixed mosques where both sects pray together.

But tensions are on the rise in Afghanistan, Pakistan, Turkey, Kuwait, Lebanon, Bahrain, Libya, Tunisia, Malaysia and Egypt. The growing concern is the possibility of a transnational civil war between Sunni and Shias where countries are divided along sectarian lines.

A collapse of states in the Middle East could follow, Olivier Roy, a history professor at the European University Institute in Italy, told New Republic. Iraq might lose Kurdistan, and Syria might collapse next: “The collapse of the existing nation-states will in turn weaken the international borders, even if they are not redrawn. The border between Iran and Iraq and the border between Turkey and its southern neighbors will be de facto open. Goods, people, and weapons will move more easily.”

As for Iraq, even Maliki’s top aide in charge of reconciliation told the New York Times that it may be fruitless to try and resolve the conflict now.

“Now there’s a war, there’s not reconciliation,” Amir al-Khuzai said. “With whom do we reconcile?”