It is believed that the Bushmen were the first of Namibia's aboriginal peoples, followed by Hottentots and Damaras, In the 15th century the Portuguese navigator Bartholomeu Dias landed on the coast. By that time the Bantus had begun moving in from the north, forcing many of the Bushmen and Hottentots into what is now South Africa, where after 1652 they were often in contact with the white settlers at the Cape of Good Hope. ("Bushmen" and “Hottentots" were names coined by these settlers for the San and the Khoi peoples respectively.)
The Bushmen gradually retreated into the more desolate areas of Namibia. Some of the racially mixed descendants of the Hottentots returned there later and organized the Hottentots of Namibia into the Nama band. In the first half of the 19th century both English and German church groups founded missions among the natives. Traders also came into the area. Meanwhile, continued Bantu migration from the north pushed the most southerly Bantu group, the Hereros, into repeated conflict with the Namas.
Another racially mixed group, known as the Basters, moved north in the late 1860's, bought land around the mission station of Rehoboth, and established a republic.
Great Britain annexed Walvis Bay for its Cape Colony in 1878, and Germany soon founded a trading post at Lüderitz and claimed the rest of the coastal area. In 1884 the entire region, except for Walvis Bay, became a German protectorate, called German South-West Africa. This move was strongly resisted by the Hereros and Namas. By 1908 the Germans had defeated the Hereros in a savage war that reduced their number by five-sixths, and the Namas also had been finally subdued. More than 100,000 Africans died in the futile resistance. The autonomy of the Rehoboth Basters, who had signed a treaty with Germany, was preserved. In 1908 diamonds were discovered at Lüderitz, bringing an influx of white colonists.
During World War I the region was occupied for the Allies by South African forces, and in 1920 the League of Nations gave South Africa a mandate over it. The name of the region then became South-West Africa. When the League was superseded by the United Nations in 1946, South Africa's request to annex the territory was denied. South Africa refused to place the territory in international trusteeship, and it remained a mandate.
Because of increasing racial segregation and denial of rights to nonwhites, the UN in 1966 declared the mandate terminated. In 1968 the UN voted to change the territory's name from South-West Africa to Namibia. South Africa ignored these actions and in 1969 tightened its control of territorial affairs. In 1971 the International Court of Justice ruled that South Africa was acting illegally. Meanwhile, the South West Africa People's Organization (SWAPO) had launched a guerrilla war to free the territory from South African control. In 1973 the UN General Assembly recognized SWAPO as the “authentic representative" of the people of Namibia.
Beginning in early 1978, five members of the UN Security Council began negotiating with South Africa and SWAPO to arrange a cease-fire and UN-supervised elections. In 1978 South Africa sponsored elections in Namibia for a national assembly. Neither the UN nor SWAPO, however, recognized the elections, and in 1983 South Africa dissolved the national assembly and reimposed direct rule.
In 1989, a cease-fire between SWAPO and South African forces went into effect, beginning a transitional period leading to independence. In elections held later that year, SWAPO won a majority in the Constituent Assembly, which then drafted the constitution. In 1990 the constitution was adopted and Namibia became independent.
The Walvis Bay enclave remained a South African possession, however. In 1991 Namibia and South Africa established a temporary joint administration over the territory and in 1994 South Africa ceded Walvis Bay to Namibia. SWAPO remained in power in Namibia through the 1990's and early 2000's.