Austronesian peoples, who form the majority of the modern population, migrated to South East Asia from Taiwan. They arrived in Indonesia around 2000 BCE, and as they spread through the archipelago, confined the native Melanesian peoples to the far eastern regions. Ideal agricultural conditions, and the mastering of wet-field rice cultivation as early as the 8th century BCE, allowed villages, towns, and small kingdoms to flourish by the 1st century CE. Indonesia’s strategic sea-lane position fostered inter-island and international trade, including links with Indian kingdoms and China, which were established several centuries BCE.Trade has since fundamentally shaped Indonesian history.
From the 7th century, the powerful Srivijaya naval kingdom flourished as a result of trade and the influences of Hinduism and Buddhism that were imported with it. Between the 8th and 10th centuries, the agricultural Buddhist Sailendra and Hindu Mataram dynasties thrived and declined in inland Java, leaving grand religious monuments such as Sailendra's Borobudur and Mataram's Prambanan. The Hindu Majapahit kingdom was founded in eastern Java in the late 13th century, and under Gajah Mada, its influence stretched over much of Indonesia.
Although Muslim traders first traveled through South East Asia early in the Islamic era, the earliest evidence of Islamized populations in Indonesia dates to the 13th century in northern Sumatra. Other Indonesian areas gradually adopted Islam, and it was the dominant religion in Java and Sumatra by the end of the 16th century. For the most part, Islam overlaid and mixed with existing cultural and religious influences, which shaped the predominant form of Islam in Indonesia, particularly in Java.