In the first century AD, two far-flung but related events helped stimulate Malaysia's emergence in international trade in the ancient world. At that time, India had two principal sources of gold and other metals: the Roman Empire and China. The overland route from China was cut by marauding Huns, and at about the same time, the Roman Emperor Vespasian cut off shipments of gold to India. As a result, India sent large and seaworthy ships, with crews reported to have numbered in the hundreds, to Southeast Asia, including the Malayan Peninsula, to seek alternative sources. In the centuries that followed, rich Malaysian tin deposits assumed great significance in Indian Ocean trade, and the region prospered. As maritime trade among Middle Eastern, Indian, and Chinese ports flourished, the peninsula benefited from its location as well as from development of its diverse resources, including tropical woods and spices. Malay ships became prominent in that trade, and Malay ports served as transshipment centers. Indian trade brought Indian culture, economy, religion, and politics, with historic results for what is now Malaysia.
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 strong points, 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 Malaysia, established from the British-ruled territories of Peninsula 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 withdrew from 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 (later 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.