The early Buddhist Malay kingdom of Srivijaya, based at what is now Palembang, Sumatra, dominated much of the Malay peninsula from the 9th to the 13th centuries AD. The powerful Hindu kingdom of Majapahit, based on Java, gained control of the Malay peninsula in the 14th century. Conversion of the Malays to Islam, beginning in the early 14th century, accelerated with the rise of the state of Malacca under the rule of a Muslim prince in the 15th century. Malacca was a major regional commercial center, where Chinese, Arab, Malay, and Indian merchants traded precious goods.
Drawn by this rich trade, a Portuguese fleet conquered Malacca in 1511, marking the beginning of European expansion in Southeast Asia. The Dutch ousted the Portuguese from Malacca in 1641. The British obtained the island of Penang in 1786 and temporarily controlled Malacca with Dutch acquiescence from 1795 to 1818 to prevent it from falling to the French during the Napoleonic war. The British gained lasting possession of Malacca from the Dutch in 1824, through the Anglo-Dutch treaty, in exchange for territory on the island of Sumatra in what is today Indonesia.
In 1826, the British settlements of Malacca, Penang, and Singapore were combined to form the Colony of the Straits Settlements. From these strongholds, in the 19th and early 20th centuries the British established protectorates over the Malay sultanates on the peninsula. During their rule the British developed large-scale rubber and tin production and established a system of public administration. British control was interrupted by World War II and the Japanese occupation from 1941 to 1945.
Popular sentiment for independence swelled during and after the war. The territories of peninsular Malaysia joined together to form the Federation of Malaya in 1948 and eventually negotiated independence from the British in 1957. Tunku Abdul Rahman became the first prime minister. In 1963 the British colonies of Singapore, Sarawak, and Sabah joined the Federation, which was renamed Malaysia. Singapore's membership was short-lived, however; it left in 1965 and became an independent republic.
Neighboring Indonesia objected to the formation of Malaysia and began a program of economic, political, diplomatic, and military "confrontation" against the new country in 1963, which ended only after the fall of Indonesia's President Sukarno in 1966. Internally, local communists, nearly all Chinese, carried out a long, bitter insurgency both before and after independence, prompting the imposition of a state of emergency from 1948 to 1960. Small bands of guerrillas remained in bases along the rugged border with southern Thailand, occasionally entering northern Malaysia. These guerrillas finally signed a peace accord with the Malaysian Government in December 1989. A separate, small-scale communist insurgency that began in the mid-1960s in Sarawak also ended with the signing of a peace accord in October 1990.