The history of Malaysia is a relatively recent offshoot of the history of the wider Malay-Indonesian world. Culturally and linguistically, there was until recent times little to distinguish the territories which now constitute Malaysia from the lands of the Malay Archipelago. Today the Malay world is divided into six states - Malaysia, Indonesia, the Philippines, Singapore, Brunei and East Timor – largely as the result of outside influences.
The earliest recorded Malay kingdoms grew from coastal city-ports established in the 10th century AD. These include Langkasuka and Lembah Bujang in Kedah, as well as Beruas and Gangga Negara in Perak and Pan Pan in Kelantan. It is thought that originally these were Hindu or Buddhist nations. The first evidence of Islam in the Malay peninsula dates from the 14th century in Terengganu, but according to the Kedah Annals, the 9th Maharaja Derbar Raja (1136-1179 AD) of Sultanate of Kedah converted to Islam and changed his name to Sultan Muzaffar Shah. Since then there have been 27 Sultans who ruled Kedah.
During the late 18th and 19th centuries, Great Britain established colonies and protectorates in the area of current Malaysia; these were occupied by Japan from 1942 to 1945. In 1948, the British-ruled territories on the Malay Peninsula formed the Federation of Malaya, which became independent in 1957. The union jack was lowered and the first Malaysian flag was raised in the Merdeka (independent) square on midnight 31st August, 1957. 6 years later, Malaysia was formed in 1963 through a merging of Malaya and Singapore, including the East Malaysian states of Sabah (known then as North Borneo) and Sarawak on the northern coast of Borneo. The first several years of the country's history were marred by Indonesian efforts to control Malaysia, Philippine claims to Sabah, and Singapore's secession in 1965.
Today's Malaysia is a constitutional monarchy, nominally headed by the Paramount Ruler (Yang di-Pertuan Agong), who is elected for a five-year term from among the nine sultans of the Malay states. In practice, however, power is held by the Prime Minister, who is the leader of elected government. The United Malays National Organisation (UMNO) party and its National Alliance (Barisan Nasional) coalition have ruled Malaysia uninterrupted since its independence, and while periodic elections are contested by feisty opposition parties, the balance has so far always been shifted in the government's favor by press control and use of restrictive security legislation dating from the colonial era.
Malaysia's development has been fast but uneven, leading to the often used description of Malaysia - "First class infrastructure, third world mentality." Contributing to this is the bumiputra or Malay-first policy, which provides privileges to the politically-powerful but traditionally poorer ethnic Malays who are the country's majority at the expense of the wealthier minority Chinese and middle-income Indian populations. The result has been the emergence of a small elite class of Malays and a new disadvantaged group of Indians, while the majority of the Malay population at which the bumiputra policy was targeted has only seen modest improvements in income and wealth. This inequity has posed challenges in moving the country forward.