In 1832, Mayotte was conquered by Andriantsoly, former king of Iboina on Madagascar; in 1833, it was conquered by the neighbouring sultanate of Mwali (Mohéli island in French). On 19 November 1835, Mayotte was again conquered by the Ndzuwani Sultanate (Anjouan sultanate in French); a governor was installed with the unusual Islamic style of Qadi (from the Arabic قاض which means judge). However, in 1836 it regained its independence under a last local Sultan. Andriantsoly won again the island in 1836, but his depopulated and unfortified island was in a weak position towards the sultans of Comoros, Malagasy kings and pirates. Looking for the help of a powerful ally, he began to negotiate with the French, installed in the nearby Malagasy island of Nosy Bé in 1840.
Mayotte was purchased by France in 1841, and integrated to the Crown. This also entailed the end of the slavery regime which had dominated the island for centuries : the slaves were sent free and most of the masters, ruined, had to leave the island.
Mayotte therefore became a French island, but it remained an island emptied of its inhabitants by decades of wars, as well as by the exodus of former elites and part of their slaves: most of the cities were abandoned, and nature regained its rights over the old plantations. The French administration therefore tried to repopulate the island, recalling first of all the Mayotte exiles or refugees in the region (Comoros, Madagascar), proposing to the former exiled masters to return in exchange for compensation, then by inviting wealthy Anjouan families to come and set up trade. France launched some first major works, such as the realization in 1848 of the Boulevard des Crabes connecting the rock of Dzaoudzi to Pamandzi and the rest of Petite-Terre.
In the wake of the West Indies and Reunion, the French government planned to make Mayotte a sugar island: despite the steep slopes, large plantations were developed, 17 sugar factories were built and hundreds of foreign workers (mainly African, in particular Mozambic Makwas) hired from 1851 onwards. However, production remained mediocre, and the sugar crisis of 1883-1885 quickly led to the end of this crop in Mayotte (which had just reached its peak of production), leaving only a few factory ruins, some of which are still visible now. The last sugar plant to be closed was Dzoumogné in 1955: the best preserved, and now heritage, is Soulou, in the west of the island.
At the Berlin conference in 1885, France took control over the whole Comoros archipelago, which was actually already ruled by French traders; the colony took the name of “Mayotte and dependencies”.
In 1898, two cyclones razed the island to the ground, and a smallpox epidemic decimated the survivors. Mayotte had to start from the beginning once again, and the French government had to repopulate the island with workers from Mozambique, Comoros and Madagascar. The sugar industry was abandoned, replaced by vanilla, coffee, copra, sisal, then fragrant plants such as vetiver, citronelle, sandalwood and especially ylang-ylang, which later became one of the symbols of the island.