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 entrepot, 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 and, in 1795, were themselves replaced by the British, who had occupied Penang in 1786.
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. Four of these states were consolidated in 1895 as the Federated Malay States.
During British control, a well-ordered system of public administration was established, public services were extended, and large-scale rubber and tin production was developed. This control was interrupted by the Japanese invasion and occupation from 1942 to 1945 during World War II.
Popular sentiment for independence swelled during and after the war and, in 1957, the Federation of Malaya, established from the British-ruled territories of peninsular Malaysia in 1948, negotiated independence from the United Kingdom under the leadership of Tunku Abdul Rahman, who became the first prime minister. The British colonies of Singapore, Sarawak, and Sabah (called North Borneo) joined the Federation to form Malaysia on September 16, 1963.
Singapore left the Federation on August 9, 1965, and became an independent republic. Neighboring Indonesia objected to the formation of Malaysia and pursued a program of economic, political, diplomatic, and military "confrontation" against the new country, which ended only after the fall of Indonesia's President Sukarno in 1966.
Following World War II, local communists, nearly all Chinese, launched a long, bitter insurgency, prompting the imposition of a state of emergency in 1948 (lifted in 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. During the 22-year term of Prime Minister MAHATHIR Mohamad (1981-2003), Malaysia was successful in diversifying its economy from dependence on exports of raw materials to the development of manufacturing, services, and tourism. Prime Minister MAHATHIR and a newly-formed coalition of opposition parties defeated Prime Minister Mohamed NAJIB bin Abdul Razak's United Malays National Organization (UMNO) in May 2018, ending over 60 years of uninterrupted rule by UMNO. MAHATHIR resigned in February 2020 amid a political dispute. King ABDULLAH then selected Tan Sri MUHYIDDIN Yassin as the new prime minister. MUHYIDDIN resigned in August 2021 after losing a majority of support in parliament. King ABDULLAH next selected ISMAIL SABRI Yakoob as the successor prime minister.