The destinies of both men were intertwined with events far beyond their native land. South Africa had taken control of Namibia, a former German colony, under a League of Nations mandate after World War I. But its refusal, much later, to give up control of what had become a virtual South African colony — run on the model of South African apartheid — played into a Cold War confrontation that drew in Cuban troops and superpower diplomacy.

Over time, American and other Western officials sought to broker a peace that would deliver independence to Namibia in return for a withdrawal of Cuban troops from neighboring Angola. The Cubans, sharing Marxist sympathies with Angola, had been deployed there to support their ideological allies around the time of Angola’s independence from Portugal in 1975.

But it was only after a showdown in the late 1980s between the Cubans and South Africa, and its surrogates, in a battle for the Angolan town of Cuito Cuanavale, that the peace deal was cemented.

In all this, Swapo’s guerrillas in the People’s Liberation Army of Namibia — backed by Cuba and the Soviet Union — played a relatively limited role. But, as in many African bush wars, the guerrillas’ aim was simply to endure.

“In the kind of anticolonial struggle they have been waging,” Joseph Lelyveld wrote in 1982, when he was the southern Africa correspondent for The New York Times, “survival and victory are virtually synonymous.”

Herman Andimba Toivo ya Toivo was born on Aug. 22, 1924, in a village near Ondangwa, in northern Namibia, an area known as Ovamboland after the territory’s biggest ethnic group, the Ovambo. He attended Christian mission schools, qualifying as a carpenter, then studied to be a teacher. During World War II he joined the segregated, all-black Native Military Corps of the South African Defense Force, which fought on the British side.