It is believed that modern humans originate from the rift valley region of East Africa, and as well as fossilized hominid remains, archaeologists have uncovered Africa's oldest human settlement in Tanzania.
From around first Millennium CE the region was settled by Bantu speaking peoples who migrated from the west and north. The coastal port of Kilwa was established around 800 CE by Arab traders, and Persians similarly settled Pemba and Zanzibar. By 1200 CE the distinctive mix of Arabs, Persians and Africans had developed into Swahili culture.
Vasco da Gama sailed up the coast in 1498, and the coastal zone soon fell under the control of Portuguese. By the early 1700s Zanzibar had become a center for the Omani Arab slave trade.
In the mid 1880s, the German Carl Peters began exploring the region, and by 1891 the colony of German East Africa had been created. In 1890, following its campaign to end the slave trade in the region, Britain made Zanzibar a protectorate.
German East Africa was made a British mandate after World War I, and renamed Tanganyika. The Tanganyika African National Union, TANU, came together to oppose British rule in 1954 -- they achieved internal self-government in 1958, and independence on 9 December 1961.
TANU's leader Julius Nyerere became prime minister, and then, when a republic was proclaimed on 9 December 1962, he became president. Nyerere introduced ujamma, a form of African socialism based on cooperative agriculture.
Zanzibar won independence on 10 December 1963 and on 26 April 1964 merged with Tanganyika to form the United Republic of Tanzania.During Nyerere's rule, the Chama Cha Mapinduzi (Revolutionary State Party) was declared the only legal political party in Tanzania. Nyerere retired from the presidency in 1985, and in 1992 the consitution was amended to allow multi-party democracy.