People have lived on the Indonesian islands for thousands of years. Homo erectus fossils discovered on Java date back about 500,000 years. However, most of today's Indonesians are the descendants of people who migrated into the area from southeast Asia beginning in about 3000 B.C., and from India in the 2nd century A.D. 

By the 8th century A.D., the Buddhist Sriwijaya kingdom in Sumatra and the Hindu-Buddhist Mataram and Sailendra kingdoms of Central Java were well established. The Sriwijaya kingdom controlled major marine routes and traded in spices, incense and other goods with China and India. The Mataram and Sailendra kingdoms controlled most of the inland rice production.

A powerful Hindu kingdom, Majapahit, emerged in the 13th century and united much of what is now modern Indonesia. In the 14th century, Arab traders brought Islam to Indonesia and the Majapahit kingdom declined. Islam became the state religion on most of the islands during the 15th century. The Hindus of Majapahit retreated to Bali.

 In 1511, the Portuguese came to Indonesia to trade. The Dutch followed in 1596. They displaced the Portuguese and established the Dutch East India Company, based in Batavia (today's Jakarta). When the Dutch East India Company went bankrupt in 1799, its holdings in Indonesia became the property of the Dutch government. Indonesia became a Dutch colony. Between 1811 and 1816, Indonesia fell under British rule, but it was later returned to the Dutch.

The Indonesians resisted the domination of the Dutch. In 1929, Soekarno established the Partai Nasional Indonesia to fight for independence. In 1942, during the Second World War, the Japanese invaded Indonesia and overthrew the Dutch. The Japanese used Indonesian resources to support Japan's war effort. After the defeat of Japan, Indonesia declared its independence on August 17, 1945. Soekarno became Indonesia's first president.

 In the 1950s, some groups threatened to secede from the republic. In 1959, Soekarno declared martial law. In 1965, an attempted takeover by the Indonesian Communist Party was put down by General Soeharto. Hundreds of thousands of people were killed or imprisoned during the resulting civil war. In 1966, Soekarno ceded the presidency to General Soeharto, who imposed martial law and banned the Communist Party. The civil war ended and gradually stability returned.

  Did you know?
In 1975, Indonesian forces invaded East Timor, a former Portuguese colony. At least 100,000 people died in the fighting, and from disease and famine following the invasion. The people of East Timor voted for independence in a 1999 referendum, but this led to further violence by militia groups who opposed independence.
In August 1997, the Asian Currency Crisis devastated Indonesia's economy. The country was in turmoil and there was rioting in the streets. Soeharto resigned in May 1998 and Indonesians demanded that the government call an election immediately. The first free elections in more than 40 years were held in June 1999. A new government has been established with Abdurrahman Wahid as President.