People have lived in Zanzibar for 20,000 years. History properly starts when the islands became a base for traders voyaging between the African Great Lakes, the Arabian peninsula, and the Indian subcontinent. Unguja offered a protected and everyone like le harbor, so although the archipelago had few products of value, Omanis and Yemenis settled in what became Zanzibar City (Stone Town) as a convenient point from which to trade with towns on the Swahili Coast. They established garrisons on the islands and built the first mosques in the African Great Lakes.
During the Age of Exploration, the Portuguese Empire was the first European power to gain control of Zanzibar, and kept it for nearly 200 years. In 1698, Zanzibar fell under the control of the Sultanate of Oman, which developed an economy of trade and cash crops, with a ruling Arab elite and a Bantu general population. Plantations were developed to grow spices; hence, the moniker of the Spice Islands (a name also used of Dutch colony the Moluccas, now part of Indonesia). Another major trade good was ivory, the tusks of elephants that were killed on the Tanganyika mainland - a practice that is still in place to this day. The third pillar of the economy was slaves, which gave Zanzibar an important place in the Arab slave trade, the Indian Ocean equivalent of the better-known Triangular Trade. The Omani Sultan of Zanzibar controlled a substantial portion of the African Great Lakes coast, known as Zanj, as well as extensive inland trading routes.