The history of Madagascar is distinguished by the early isolation of the landmass from the ancient supercontinents containing Africa and India, and by the island's late colonization by human settlers arriving in outrigger canoes from the Sunda islands between 200 BC and 500 AD.
These two factors facilitated the evolution and survival of thousands of endemic plant and animal species, some of which have gone extinct or are currently threatened with extinction due to the pressures of a growing human population. Over the past two thousand years the island has received waves of settlers of diverse origins including Austronesian, Bantu, Arab, South Asian, Chinese and European populations.
The majority of the population of Madagascar today is a mixture of Austronesian, North Indian, Arab, Somali and Bantu settlers from Southeast Asia, Gujarat, the Arabian Peninsula, Somalia and the African Great Lakes, respectively. Years of intermarriages created the Malagasy people, who primarily speak Malagasy, an Austronesian language with Bantu influences.
Most of the genetic makeup of the average Malagasy, however, reflects an almost equal blend of Austronesian and Bantu influences (especially on coastal regions). Other populations often intermixed with the existent population to a more limited degree or have sought to preserve a separate community from the majority Malagasy.
By the European Middle Ages, over a dozen predominant ethnic identities had emerged on the island, typified by rule under a local chieftain. Among some communities, such as the Sakalava, Merina and Betsimisaraka, leaders seized the opportunity to unite these disparate communities and establish true kingdoms under their rule. These kingdoms increased their wealth and power through exchanges with European, Arab and other seafaring traders, whether they were legitimate vessels or pirates.
Between the 16th and 18th centuries, pirate activity in the coastal areas of Madagascar was common and the celebrated free pirate colony of Libertatia was established on Saint Mary's Island, originally populated by local Malagasy. The Sakalava and Merina kingdoms in particular exploited European trade to strengthen the power of their kingdoms, trading Malagasy slaves in exchange for European firearms and other goods.
By the turn of the 19th century, the highly populous Kingdom of Imerina, located in the central highlands with its capital at Antananarivo, began to exert its authority over the island's other polities and populations. A series of Merina monarchs ruled over the Kingdom of Madagascar throughout the 19th century and engaged in the process of modernization through close diplomatic ties to Britain that led to the establishment of European-style schools, government institutions and infrastructure.
From the 17th century through to the Scramble for Africa, the British and French colonial empires competed for influence in Madagascar. After a brief de facto protectorate period beginning in 1885 the island became a full formal French protectorate in 1890, then a colony in 1896, and gained full independence from France in 1960 in the wake of decolonization.
Under the leadership of President Philibert Tsiranana, Madagascar's First Republic (1960–1972) was established as a democratic system modeled on that of France. This period was characterized by continued economic and cultural dependence upon France, provoking resentment and sparking popular movements among farmers and students that ultimately ushered in the socialist Second Republic under Admiral Didier Ratsiraka (1975–1992) distinguished by economic isolationism and political alliances with pro-Soviet states. As Madagascar's economy quickly unraveled, standards of living declined dramatically and growing social unrest was increasingly met with violent repression on the part of the Ratsiraka government.
Tension over popular dissatisfaction with Ratsiraka's rule was brought to a head when presidential guards were ordered to open fire on unarmed pro-democracy protesters in 1989. By 1992, free and fair multiparty elections were held, ushering in the democratic Third Republic (1992–2009). Under the new constitution, the Malagasy public elected President Albert Zafy, President Didier Ratsiraka, and most recently President Marc Ravalomanana.
This latter was ousted in March 2009 by a popular movement under the leadership of Andry Rajoelina, then-mayor of Antananarivo, in what has been widely characterized as a coup d'état. Rajoelina has since ushered in a Fourth Republic and rules Madagascar as the President of the High Transitional Authority without recognition from the international community.