Singapore's history dates back at least eight hundred years, having been a maritime emporium known as Temasek and subsequently a major constituent part of several successive thalassocratic empires.
Its contemporary era began in 1819, when Stamford Raffles established Singapore as an entrepôt trading post of the British Empire.
In 1867, the colonies in Southeast Asia were reorganised, and Singapore came under the direct control of Britain as part of the Straits Settlements.
During World War II, Singapore was occupied by Japan in 1942 and returned to British control as a separate Crown colony following Japan's surrender in 1945.
Singapore gained self-governance in 1959 and, in 1963, became part of the new federation of Malaysia, alongside Malaya, North Borneo, and Sarawak.
Ideological differences, most notably the perceived encroachment of the egalitarian "Malaysian Malaysia" political ideology led by Lee Kuan Yew into the other constituent entities of Malaysia—at the perceived expense of the bumiputera and the policies of Ketuanan Melayu—eventually led to Singapore's expulsion from the federation two years later; Singapore became an independent sovereign country in 1965.