Zanzibar (pronounced zænzibar) is part of the East African republic of Tanzania. It consists of the Zanzibar Archipelago in the Indian Ocean, 25–50 km (15–30 mi) off the coast of the mainland. It consists of numerous small islands and two large ones: Unguja (the main island, informally referred to as "Zanzibar"), and Pemba. Zanzibar was once a separate state with a long trading history within the Arab world; it united with Tanganyika to form Tanzania in 1964 and still enjoys a high degree of autonomy within the union. The capital of Zanzibar, located on the island of Unguja, is Zanzibar City, and its old quarter, known as Stone Town, is a World Heritage Site.
The presence of microlithic tools attests to at least 20,000 years of human occupation of Zanzibar. The islands became part of the historical record of the wider world when Arab traders discovered them and used them as a base for voyages between Arabia, India, and Africa. Unguja offered a protected and defensible harbour, so although the archipelago offered few products of value, the Arabs settled at what became Zanzibar City (Stone Town) as a convenient point from which to trade with East African coastal towns. They established garrisons on the islands and built the first mosque in the Southern hemisphere.
During the Age of Exploration, the Portuguese Empire was the first European power to gain control of Zanzibar, and the Portugese 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. Plantations were developed to grow spices, hence the term Spice Islands. Another major trade good for Zanzibar was ivory. The third pillar of the economy was slavery, giving Zanzibar an important place in the Arab slave trade, the Indian Ocean equivalent of the better-known Triangular Trade. Zanzibar City was the main trading port of the East African slave trade with about 50,000 slaves a year passing through the city. The Sultan of Zanzibar controlled a substantial portion of the East African coast, known as Zanj; this included Mombasa, Dar es Salaam, and trading routes that extended much further inland, such as the route leading to Kindu on the Congo River.
The islands gained independence from Britain in December 1963 as a constitutional monarchy. A month later, the bloody Zanzibar Revolution, in which thousands of Arabs and Indians were killed in a genocide and thousands more expelled, led to the establishment of the Republic of Zanzibar and Pemba. That April, the republic was subsumed by the mainland former colony of Tanganyika. This United Republic of Tanganyika and Zanzibar was soon renamed (as a portmanteau) the United Republic of Tanzania, of which Zanzibar remains a semi-autonomous region.