Although Singapore's history dates from the 11th century, the island was little known to the West until the 19th century, when in 1819, Sir Thomas Stamford Raffles arrived as an agent of the British East India Company. In 1824, the British purchased Singapore Island, and by 1825, the city of Singapore had become a major port, with trade exceeding that of Malaya's Malacca and Penang combined. In 1826, Singapore, Penang, and Malacca were combined as the Straits Settlements to form an outlying residency of the British East India Company; in 1867, the Straits Settlements were made a British Crown Colony, an arrangement that continued until 1946.
The opening of the Suez Canal in 1869 and the advent of steamships launched an era of prosperity for Singapore as transit trade expanded throughout Southeast Asia. In the 20th century, the automobile industry's demand for rubber from Southeast Asia and the packaging industry's need for tin helped make Singapore one of the world's major ports.
In 1921, the British constructed a naval base, which was soon supplemented by an air base. But the Japanese captured the island in February 1942, and it remained under their control until September 1945, when it was recaptured by the British.
In 1946, the Straits Settlements was dissolved; Penang and Malacca became part of the Malayan Union and Singapore became a separate British Crown Colony. In 1959, Singapore became self-governing, and, in 1963, it joined the newly independent Federation of Malaya, Sabah, and Sarawak (the latter two former British Borneo territories) to form Malaysia.
Indonesia adopted a policy of "confrontation" against the new federation, charging that it was a "British colonial creation," and severed trade with Malaysia. The move particularly affected Singapore, since Indonesia had been the island's second-largest trading partner. The political dispute was resolved in 1966, and Indonesia resumed trade with Singapore.
After a period of friction between Singapore and the central government in Kuala Lumpur, Singapore separated from Malaysia on August 9, 1965, and became an independent republic.