The first inhabitants probably arrived in the archipelago from Sri Lanka and southern India before 500 BC. Some archaeologists - including the explorer Thor Heyerdahl - believe that an ancient race of sun-worshipping people called the Redin were the first settlers; their custom of orienting important buildings towards the sun is still evident today in the layout of many Maldivian mosques. Most experts agree that these early settlers were absorbed into the Buddhist culture brought to the Maldives by settlers from Sri Lanka and India after 500 BC.
Arab traders en route to the Far East recorded visits to the Maldives from the 2nd century AD onwards. Known as the 'Money Isles', they provided enormous quantities of cowrie shells, an international currency of the early ages.
The conversion to Islam, in 1153 AD, is a watershed in Maldivian history. According to legend, a sea jinni (evil spirit) called Rannamaari demanded regular sacrifices of young virgin girls in Malé. Abu Al Barakat, a visiting North African Arab, took the place of a sacrificial virgin, and drove the demon away by reading from the Koran, the Islamic holy book. The Maldivian king at the time was sold on Islam, and Barakat later became the first sultan. A series of six sultanic dynasties followed - 84 sultans and sultanas in all. At one stage, when the Portuguese first arrived in the 16th century, there were actually two ruling dynasties: the Malei and the Hilali.
The Portuguese, eager for a greater share of the profitable trade routes of the Indian Ocean, were granted permission to build a fort and a factory in Malé, but it wasn't long before they wanted more from the Maldives. In 1558, Captain Andreas Andre led a Portuguese invasion which killed Sultan Ali VI. Andre ruled Malé and much of the country for the next 15 years. Portuguese occupation came to a sticky end in 1573 when an island chief, Mohammed Thakurufaan, led an attack on the main Portuguese garrison and slew the lot.
In the 17th century, the Maldives came under the protection of the Dutch and later the British, but neither established a colonial administration. In the 1860s Borah merchants from Bombay set up warehouses and shops in Malé, and quickly acquired an almost exclusive monopoly on foreign trade. Sultan Mohammed Mueenuddin II, weary of the Borahs' economic grip, signed an agreement with the British in 1867 which guaranteed the islands' full independence. The Maldives subsequently became a British protectorate, which allowed the British to establish defence facilities on some outlying islands.