For nearly three decades, Fidel Castro devoted vast amounts of Cuba’s limited resources to the project of exporting his revolution to Africa, even as it stuttered at home. As leader of Cuba, Castro advocated a radical departure from the prevailing post-war liberal internationalism, premised more on the ideas of Frantz Fanon than those of Adam Smith. Decolonization seemed to offer a prime laboratory for that vision. Cuba volunteered doctors, nurses, military advisers, and troops to support what Castro and Che Guevara saw as progressive regimes—“sister countr[ies],” in Havana’s terminology—in Algeria, Eastern Congo-Kinshasa (today’s Democratic Republic of Congo), Congo-Brazzaville, Guinea-Bissau, and, later, Ethiopia.

In the days since his death, and in parallel with obituaries detailing his record of violence and repression at home, Castro has been widely celebrated for his role in southern Africa in particular, a region where he supported Angolan revolutionaries pitted against the U.S.-backed apartheid regime of South Africa. And yet Cuba’s role on the continent also illuminates some of the contradictions of advancing an anti-imperial agenda, premised on social and racial justice, in part through the execution of proxy wars abroad.

Beginning in the 1960s, Castro and Guevara developed a relationship with Angola’s People’s Movement for the Liberation of Angola (MPLA), then locked in an anti-colonial struggle against Portuguese rule. When Portugal’s armed forces staged a mutiny in 1975, a power vacuum ensued. The MPLA was well-positioned to take over, but the National Front for the Liberation of Angola (FNLA) and National Union for the Total Independence of Angola (UNITA) had ideas of their own, forming a fragile alliance. Both would have been utterly uncompetitive, were it not for their foreign backers: Mobutu Sese Seko of Zaïre (the newly renamed Congo-Kinshasa), South Africa’s apartheid government, and the United States. It was an alliance of rare disrepute. In the second half of 1975, tensions between the three Angolan movements became skirmishes, before erupting into open warfare. A minor conflict in a distant African country, ruled for 500 years by a country back in Europe, suddenly came to be seen as a test of wills for different political blocs and their visions for the world’s future.

Each side ratcheted up their contributions in response to the other. Cuba’s contribution soon increased from doctors and technicians to military advisors, infantry, and officers. On the other side of the conflict, South Africa and the United States each saw the MPLA’s rise as a potential triumph for global communism. In August 1975, President Gerald Ford told Secretary of State Henry Kissinger, “I have decided on Angola. … [I]f we do nothing, we will lose Southern Africa.”

Both the United States and South Africa launched separate covert programs to funnel aid and weapons to the FNLA and UNITA, only to find that their rag-tag forces needed much more. Many of the fighters lacked boots and basic military gear. Few had handled sophisticated firearms before, let alone mortars or mines. Though some units had waged guerrilla campaigns against the Portuguese, none had experience in the conventional warfare needed to seize land from the MPLA. The allies realized that a support role would not be enough; they would have to take the lead, deploying regular troops under their own command.

In the wake of the Vietnam War, the U.S. Congress and American public opinion were extremely hostile to another military commitment abroad in a place even more unknown to them than southeast Asia. But elements in the apartheid regime were deeply concerned that an MPLA government in Angola might become a springboard for the African National Congress and for the South West Africa People's Organization, which contested South Africa’s control over South-West Africa (what today is Namibia), through an expired League of Nations mandate. With the white South Africans volunteering a full military effort, the Ford administration decided to let them do America’s dirty work. The South Africans could, and should, have secured an explicit quid pro quo for offering to be America’s shock troops, but failed to do so.

Due to the diplomatic toxicity of South Africa’s apartheid policies, the operation was conducted in absolute secrecy. Perhaps only a few leaders in Pretoria understood its full extent. Few American officials knew what was going on either, and those that did lied about it. When the operation was exposed in December 1975, President Ford instructed his African embassies to tell their host governments, “The U.S. in no way sought or encouraged the South Africans to become involved in Angola nor was our advice sought.” This was not true. In his memoirs, Kissinger’s account of the entire enterprise in Angola can only be described as extremely misleading.

While the Western alliance hid its actions and hoped for the best, Castro saw Angola as an ideal opportunity to pursue his African campaign. When Cuban emissary Major Raúl Díaz Argüelles returned from Angola in early August 1975, he told Raúl Castro, Fidel’s brother and eventual successor: “[MPLA leader Agostinho Neto] wants to make the situation in Angola a vital issue between the systems of Imperialism and Socialism… [T]he sides are clearly defined, the FNLA and UNITA represent the international Imperialist forces and the Portuguese reac­tion, and the MPLA represents the progressive and nationalist forces.” Cuba agreed wholeheartedly with this framing of the conflict, and when South Africa’s military intervention was uncovered, the Havana-Luanda alliance found it had a public relations bonanza on its hands.

For Castro, however, what was at stake was much more than just a Cold War win. In the initial conflict, South Africa’s military surged northwards until it was halted by the Cubans in late 1975; a nearly 13-year stalemate ensued. Over 337,000 Cuban soldiers served in Angola, of whom over 2,000 died, according to official figures. But Havana’s contribution went far beyond the military. As historian Edward George notes, “For a generation of Cubans, internationalist service in Angola represented the highest ideal of the Cuban Revolution.” Waves of doctors, teachers, and engineers flooded war-torn Angola, while thousands of talented Angolan students received scholarships to study back in Cuba. Washington and Pretoria offered nothing of the kind. As the revolutionary cause stalled in Algeria, Guinea-Bissau, and elsewhere, and Havana’s clients in Ethiopia turned out to be (among other things) murderous thugs, Angola became the showcase for Castro’s ideology.

The main target of this policy was not so much the United States, but South Africa’s apartheid regime. From the late 1970s onwards, black political mobilization intensified, the country’s racially stratified economy stalled, and white manpower and expertise became ever scarcer, as the lure of a less-complicated life in Australia or Britain grew. In this context, Cuba forced the apartheid regime to fight a costly war of attrition, thousands of miles from South Africa. Into the 1980s, its government repeatedly increased taxes to pay for the sustained military effort. Vast quantities of political and economic resources were divested in an effort to circumvent military sanctions and produce sophisticated weapons systems at home. The government itself became steadily militarized. Conscription for white males was extended to fully two years; this only boosted emigration, while many returned home from the front disillusioned, or worse.

Castro’s military was never quite able to land a knock-out blow on the battlefield. Part of that was due to ongoing American support for the UNITA-South Africa alliance in southern Angola. America’s covert operatives were useful, but it was the diplomatic protection and copious funding that was invaluable, because the South Africans and UNITA struggled to provide either. Both Presidents Ronald Reagan and  George H. W. Bush hosted UNITA leader Jonas Savimbi at the White House, despite the fact that his organization was known to traffic in conflict diamonds, conscript child soldiers, and impose strict discipline in its ranks through burning dissenters at the stake. The MPLA’s human rights record, too,  was hardly spotless.

America’s political alignment with the apartheid regime remains a black spot on its national past. Even as late as 1986, Reagan vetoed the Comprehensive Anti-Apartheid Act, the very same year that South Africa’s Broederbond, a shadowy ethno-nationalist organization for Afrikaner elites, itself disavowed apartheid. When choosing between defending the paragon of global racism—even as apartheid’s most ardent backers were themselves looking in new directions—and softening its hard line against Cuba, Washington chose the former. In the third world, it was yet another public relations victory for Fidel Castro, all in spite of his human rights record and Cuba’s unappealing economic model at home. No wonder coming to terms with his legacy is so difficult.

None of this should obscure the many failures and contradictions of Cuba’s African foreign policy. Most of Castro’s partners calcified into one-party regimes manifesting few of his lofty ideals. Castro’s opposite number in the MPLA’s Angolan regime was José Eduardo dos Santos—still the leader of Angola today. Few of Cuba’s allies fully reciprocated Castro’s generosity. In this context, it seems likely that much of the enduring enthusiasm on the part of Havana for its African mission stemmed from its ideological value. Foreign successes perhaps helped to obscure that the revolution was stalling badly at home. Then there was the unmissable irony at the heart of the whole policy: Havana made judgments about which third-world movements most resembled its model for the future, and then put its credibility in the hands of local leaders with their own priorities—similar to what Washington was doing at the same time.

But there was one big win. Cuba’s deeply improbable campaign in distant southern Africa was an important factor in the demise of apartheid, though it was not, as some claim, the dominant or decisive one. The South African system was imploding anyhow, as the Broederbond’s 1986 epiphany attests. But the war did accelerate a loss of white confidence in the regime and its apartheid model. Cuba’s campaign indirectly forced white voters and their family members to personally sacrifice in defense of apartheid—sacrifices they were, ultimately, unwilling to continue making.

By contrast, Castro was prepared to bear the costs of his vision, and to force them upon Cuba. “The cost in human terms is enormous,” he told Neto. “This effort requires great sacrifice for tens of thousands of families who have a son, or a father, or a brother abroad.” As this revealing statement suggests, Fidel Castro’s African adventure—improbable as it was—was hardly without contradictions.