The history of the arrival of Islam in Indonesia is somewhat unclear. One theory states that Islam arrived directly from Arabia as early as the 9th century, during the time of the Umayyad and Abbasid caliphates. Another theory credits Sufi travelers for bringing Islam in the 12th or 13th century, either from Gujarat in India or from Persia. Before the archipelago's conversion to Islam, the predominant religions in Indonesia were Hinduism (particularly its Shaivism tradition) and Buddhism.

The islands that now constitute Indonesia have been recognized for centuries as a source of spices such as nutmeg and cloves, which were key commodities in the spice trade long before the Portuguese arrived in the Banda Islands in 1511. Due to the archipelago's strategic place as the gateway between the Muslim world and Imperial China, it became a busy international hub for merchants engaged in many forms of trade. It became a place where different peoples shared their respective cultures, including Islam.

Despite being one of the most significant developments in Indonesian history, evidence about the coming of Islam to Indonesia is limited; there is considerable debate among scholars about what conclusions can be drawn about the conversion of Indonesian peoples. The primary evidence, at least of the earlier stages of the process, are gravestones and a few travelers' accounts, but these can only show that indigenous Muslims were in a certain place at a certain time. This evidence cannot explain more complicated matters such as how lifestyles were affected by the new religion or how deeply it affected societies. It cannot be assumed, for example, that because a ruler was known to be a Muslim, the Islamization of that area was therefore widespread. Nevertheless, a clear turning point occurred when the Hindu Majapahit empire in Java fell to the Islamised Demak Sultanate. In 1527, the Muslim ruler renamed the newly conquered Sunda Kelapa as Jayakarta (meaning "precious victory") which was eventually contracted to Jakarta.

The spread of Islam was slow. The limited evidence that is currently known suggests that the spread of Islam accelerated in the 15th century. One of the defining characteristics of the spread was that it was achieved through generally peaceful means. As Muslim traders settled in coastal areas, they began to assimilate with the local population. Soon new Muslim communities were created, as evidenced by the travel journals of Ibn Battuta, Zheng He, and Marco Polo. Many Muslims inter-married with royalties, with their descendants establishing various sultanates in Sumatra and Java.

Dominant kingdoms included Mataram in Central Java, and the sultanates of Ternate and Tidore in the Maluku Islands to the east. By the end of the 13th century, Islam had been established in North Sumatra; by the 14th in northeast Malaya, Brunei, the southern Philippines and among some courtiers of East Java; and the 15th in Malacca and other areas of the Malay Peninsula. Although it is known that the spread of Islam began in the west of the archipelago, the fragmentary evidence does not suggest a rolling wave of conversion through adjacent areas; rather, it suggests the process was complicated and slow.

Early history

Before Islam was established in Indonesian communities, Muslim traders had been present for several centuries. Ricklefs identifies two overlapping processes by which the Islamisation of Indonesia occurred: (1) Indonesians came into contact with Islam and converted, and (2) foreign Muslim Asians (Indians, Chinese, Arabs, etc.) settled in Indonesia and mixed with local communities. Islam is thought to have been present in Southeast Asia from early in the Islamic era. When, why and how the earliest Muslims converted in Indonesia is a matter of debate. There are no definite conclusions as to how the process of early Islamisation occurred with any certainty, due to the lack of written sources.

The earliest accounts of the Indonesian archipelago date from the Abbasid Caliphate. According to those early accounts, the Indonesian archipelago was famous among early Muslim sailors, mainly due to its abundance of precious spice trade commodities such as nutmeg, cloves, galangal and many other spices.

The presence of foreign Muslims in Indonesia does not, however, demonstrate a significant level of local conversion or the establishment of local Islamic states. The most reliable evidence of the early spread of Islam in Indonesia comes from inscriptions on tombstones and a limited number of travellers' accounts. The earliest legibly inscribed tombstone is dated AH 475 (AD 1082), although as it belongs to a non-Indonesian Muslim, there is doubt as to whether it was transported to Java at a later time. The first evidence of Indonesian Muslims comes from northern Sumatra. In 1111, some local Acehnese were converted by an Arab called 'Abd-Allah 'Arif. One of his disciples, Burhan al-Din spread Islam as far as Pariaman at Minangkabau region in West Sumatra. Marco Polo, on his way home from China in 1292, reported at least one Muslim town; and the first evidence of a Muslim dynasty is the gravestone, dated AH 696 (AD 1297), of Sultan Malik al Saleh, the first Muslim ruler of Samudera Pasai Sultanate, with further gravestones indicating continued Islamic rule. The presence of the Shafi'i school of thought, which later came to dominate Indonesia, was reported by Ibn Battuta, a Moroccan traveller, in 1346. In his travel log, Ibn Battuta wrote that the ruler of Samudera Pasai was a Muslim who performs his religious duties with utmost zeal. The school of thought he used was Al-Shafi‘i with similar customs to those he had seen in India. Many of the Indonesians who studied in Hejaz had specifically sought Kurdish teachers, likely due to them also being Shafi'i. Kurdish teaching had an influence on Indonesian Muslims.Mullas, Sufis and Heretics: The Role of Religion in Kurdish Society: Collected Articles, Martin van Bruinessen, 2000, pp. 127

Influences of Zheng He's voyages

Zheng He is credited to have settled Chinese Muslim communities in Palembang and along the shores of Java, the Malay Peninsula, and the Philippines. These Muslims allegedly followed the Hanafi school in the Chinese language. This Chinese Muslim community was led by Hajji Yan Ying Yu, who urged his followers to assimilate and take local names.

Zheng He (1371–1433 or 1435), originally named Ma He, was a Hui court eunuch, mariner, explorer, diplomat, and fleet admiral during China's early Ming dynasty. Zheng commanded expeditionary voyages to Southeast Asia, South Asia, Western Asia, and East Africa from 1405 to 1433. His larger ships stretched 400 feet in length (Columbus's Santa Maria, for comparison, was 85 feet). These carried hundreds of sailors on four tiers of decks. As a favorite of the Yongle Emperor, whose usurpation he assisted, he rose to the top of the imperial hierarchy and served as commander of the southern capital Nanjing (the capital was later moved to Beijing by the Yongle Emperor). These voyages were long neglected in official Chinese histories but have become well-known in China and abroad since the publication of Liang Qichao's Biography of Our Homeland's Great Navigator, Zheng He in 1904. A trilingual stele left by the navigator was discovered on the island of Sri Lanka shortly thereafter.

By region It was initially believed that Islam penetrated Indonesian society in a largely peaceful way, (which is still largely true according to many scholars) and from the 14th century to the end of the 19th century the archipelago saw almost no organised Muslim missionary activity.Nieuwenhuijze (1958), p. 35. Later findings of scholars say that some parts of Java, i.e. Sunda kingdom West Java and the kingdom of Majapahit on East Java was conquered by Javanese Muslims. The Hindu-Buddhist Sunda Kingdom of Pajajaran was conquered by Muslims in the 16th century, while the Muslim-coastal and Hindu-Buddhist-interior part of East Java was often at war. Organised spread of Islam is also evident by the existence of the Wali Sanga (nine holy patriarchs) who are credited for the Islamisation of Indonesia during this period.

Northern Sumatra

Firmer evidence documenting continued cultural transitions comes from two late-14th century gravestones from Minye Tujoh in North Sumatra, each with Islamic inscriptions but in Indian-type characters and the other Arabic. Dating from the 14th century, tombstones in Brunei, Terengganu (northeast Malaysia) and East Java are evidence of Islam's spread. The Trengganu stone has a predominance of Sanskrit over Arabic words, suggesting the representation of the introduction of Islamic law. According to the Ying-yai Sheng-lan: The overall survey of the ocean's shores' (1433) a written account by Zheng He's chronicler and translator Ma Huan: "the main states of the northern part of Sumatra were already Islamic Sultanates. In 1414, he visited the Malacca Sultanate, its ruler Iskandar Shah was Muslim and also his people, and they were very strict believers".

In Kampong Pande, the tombstone of Sultan Firman Syah, the grandson of Sultan Johan Syah, has an inscription stating that Banda Aceh was the capital of the Kingdom of Aceh Darussalam and that it was built on Friday, 1 Ramadhan (22 April 1205) by Sultan Johan Syah after he defeated the Hindu and Buddhist Kingdom of Indra Purba whose capital was Bandar Lamuri. The establishment of further Islamic states in North Sumatra is documented by late 15th- and 16th-century graves including those of the first and second Sultans of Pedir; Muzaffar Syah, buried (1497) and Ma'ruf Syah, buried (1511). Aceh was founded in the early 16th century and would later become the most powerful North Sumatran state and one of the most powerful in the whole Malay archipelago. The Aceh Empire's first sultan was Ali Mughayat Syah whose tombstone is dated (1530).

The book of Portuguese apothecary Tomé Pires that documents his observations of Java and Sumatra from his 1512 to 1515 visits, is considered one of the most important sources on the spread of Islam in Indonesia. In 1520, Ali Mughayat Syah started military campaigns to dominate the northern part of Sumatra. He conquered Daya, and submitted the people to Islam. Further conquests extended down the east coast, like Pidie and Pasai incorporating several pepper-producing and gold-producing regions. The addition of such regions ultimately led to internal tensions within the Sultanate, as Aceh's strength was as a trading port, whose economic interests vary from those of producing ports.

At this time, according to Pires, most Sumatran kings were Muslim; from Aceh and south along the east coast to Palembang the rulers were Muslim, while south of Palembang and around the southern tip of Sumatra and up the west coast, most were not. In other Sumatran kingdoms, such as Pasai and Minangkabau the rulers were Muslim although at that stage their subjects and peoples of neighboring areas were not, however, it was reported that the religion was continually gaining new adherents.

After the arrival of the Portuguese colonials and the tensions that followed regarding control of the spice trade, the Acehnese Sultan Alauddin al-Kahar (1539–71) sent an embassy to the Ottoman Sultan Suleiman the Magnificent in 1564, requesting Ottoman support against the Portuguese Empire. The Ottomans then dispatched their admiral Kurtoğlu Hızır Reis he set sail with a force of 22 ships carrying soldiers, military equipment and other supplies. According to accounts written by the Portuguese Admiral Fernão Mendes Pinto, the Ottoman fleet that first arrived in Aceh consisted of a few Turks and largely of Muslims from the ports of the Indian Ocean.

East Sumatra and Malay peninsula