Islam and nationalism

The relationship between Islam and nationalism, from the beginnings of Islam until today, has often been tense, with both Islam and nationalism generally opposing each other.

Quran and hadith
The 13th verse of Al-Hujurat states: "O people, We have created you male and female and made you into nations and tribes that you may know one another [not to fight each other]. Verily, the most noble of you to Allah is the most righteous of you. Verily, Allah is knowing and aware."

Some Muslims believe that Muhammad condemned nationalism in many ahadith, stating "Whoever fights under a banner of foolishness [tribalism], supports tribalism, or gets angry for the sake of tribalism, he will die in a state of ignorance". When asked about nationalism he answered by saying "Leave it, it is rotten". Some Muslims believe that he declared nationalists as non-Muslims by saying "He is not one of us who calls to tribalism. He is not one of us who fights for the sake of tribalism. He is not one of us who dies following the way of tribalism". He had travelled to Medina to solve the long and bloody conflict between the Khazraj and Aws tribes. Eventually, both tribes converted to Islam and became the Ansar. Muhammad also said that the Ghuraba will be "those who disassociated themselves from their tribes."

Modern history
In the late 1800s and early 1900s, various nationalist ideologies emerged from the Middle East, including Turkish nationalism, Arab nationalism, Iranian nationalism, and all 3 of these ideologies paved way for Kurdish nationalism, which started off as a defensive movement against them. This was also the period when the Salafi movement, Islamism, and Pan-Islamism emerged, with the latter rejecting the concept of nations in favour of one Islamic nation.

Jamal al-Din al-Afghani led an anti-nationalist movement and wanted unity among Muslims. Afghani feared that nationalism would divide the Muslim world and believed that Muslim unity was more important than ethnic identity. Muhammad Rashid Rida, a student of Afghani and of Afghani's disciple Muhammad Abduh, would continue this belief. Rida believed that the unification of the Islamic community would only be possible through the restoration of an Islamic caliphate which implements the Sharia. Rida called on Arabs to make a pan-Islamist project aimed at the revival of the Islamic caliphate which incorporates all Muslim lands. Rida also called upon Muslims to build a political system based on Islam; rather than nationalism, which he frequently condemned as a Western ideology.

Around 1908 was when Turkish nationalism began significantly rising. Towards the end of the Ottoman Empire, the Turkish National Movement led by Mustafa Kemal Atatürk had made way for the ideology of Kemalism, which became the founding ideology of Turkey. The Kemalists aimed to Turkify and secularise and Turkey and went as far as banning the hijab and the adoption of the Turkish adhan. In Turkey, the radical Kemalist reforms led to a birth of the ideology known as the Kurdish-Islamic synthesis. Many decades later, during the Cold War and Operation Gladio, the Turkish–Islamic synthesis emerged, where Alparslan Türkeş, an advocate of the Turkish adhan, began opening Grey Wolves training camps with American support to train its members to fight against leftists, Alevis, Kurds, as well as Islamists that did not accept Turkish nationalism.

In 1925, with the rule of the Pahlavi dynasty, Iran had also became a secular state with nationalist policies. Iran had been increasingly secularised and also Westernised until the Iranian Revolution which made Islam the basis of Iranian politics. Ruhollah Khomeini also aimed for the unity of all Muslims under the Guardianship of the Islamic Jurist. Khomeini made many attempts to bridge the divide between Sunnis and Shias and also to eradicate nationalism in Iran.

Arab nationalism emerged in the 1920s and became the leading ideology in the mashriq. Its influence grew and Arab nationalists seized control of various Arab countries. Gamal Abdel Nasser later came and boosted Arab nationalism, and political parties like the Ba'ath Party did as well. Islamism began challenging Arab nationalism and being its top political opponent. Arab nationalism decreased due to lost morale after the Six-Day War. The Muslim Brotherhood then stepped up its actions against Arab nationalism, especially in Egypt and Syria, which were the leading places for Arab nationalism. The Syrian Ba'ath Party regularly attacked religion, and came into conflict with other Arab nationalist ideologies like Nasserism, which was accused by the Syrian Ba'athists of betraying socialist ideals. Nasser later accused the Ba'athists of being anti-religion and promoting sectarianism among Arabs. The Iraqi Ba'ath Party, especially during the rule of Saddam Hussein, was a secular and socialist party just like the Syrian Ba'ath Party. However, the Iraqi Ba'ath Party had a much stronger Anti-Iranian sentiment and only turned religious after the Faith Campaign after Iraq's defeat during the Gulf War but kept the nationalism.

Hizb ut-Tahrir is extremely opposed to nationalism.

Despite the inconsistency of Islam and nationalism, Pakistani nationalism is religious rather than secular, with Islam being the center of it. Hamas also mixes Palestinian nationalism with Islamism, which makes it have conflicts with ISG and other Salafist organizations. Jaish ul-Adl mixes Baloch nationalism with Islam. The Taliban's official ideology combines Islamism with Pashtunwali, also being one of the causes of the Islamic State–Taliban conflict. Al-Shabaab incorporates an Anti-Ethiopian sentiment, inspired by Somali nationalism, into its ideology.