In his eulogy for Nelson Mandela in Johannesburg on Tuesday, President Obama referred to the anti-apartheid leader and South African president as "the last great liberator of the 20th century." He also implicitly chided the liberators who didn't, perhaps referring to fellow memorial attendee and Cuban leader Raul Castro. "There are too many leaders who claim solidarity with Madiba’s struggle for freedom, but do not tolerate dissent from their own people," Obama said.

Mandela will long be remembered, alongside the very different but similarly history-changing Mohandas Gandhi, as a symbolic leader of the liberation movements that marked the latter half of the 20th century. Those movements swept through the so-called "third world" – the developing countries of Asia, Africa and Latin America, caught between the Western "first world" and the Soviet-dominated "second world." They promised to liberate their societies from the bonds of colonialism and from the foreign meddling of the Cold War era.

But those liberation movements did not always deliver on their promises, often trapping the people they'd pledged to liberate in different sorts of bonds: dictatorships, civil wars, secular nationalism. Mandela's greatness was, in part, that he succeeded in living up to the promises of liberation where so many other leaders failed. If Mandela represented liberation movements at their best, though, he also never really broke from them at their worst, a contradiction gently hinted at by Tuesday's ceremony.

In the first decades after World War II, as liberation movements sprung up throughout the developing world, they began with a share mission: freedom from foreign control. Many of the movements embraced communism or socialism, which promised liberation for long-oppressed lower classes and stood as an alternative to the Western capitalism of European colonialists. Although the anti-apartheid movement never embraced communism as fully as movements elsewhere in the world, Mandela appears to have likely at least dabbled in it.

In those years of common cause, disparate movements would sometimes work together. And why shouldn't they? They were fighting against what they saw as the shared yoke of colonialism, guided by a common language of socialism and anti-imperialism. It was not obvious at the time how differently these movements would behave once they begin to win power.

Few liberation leaders better exemplified how wrong those movements could go than Fidel Castro, whose rebellion ousted Cuba's pro-U.S. government in 1959, and Moammar Gaddafi, who seized power in Libya in 1969. Both became, and remained, close friends and staunch supporters of South Africa's anti-apartheid movement.

Although we in the West see Mandela and Gaddafi as polar opposites, one a democratically elected leader who sought to help his people and the other a militaristic dictator who exploited them, from within the wider liberation movement their points of commonality are more apparent. Mandela, we like to forget, was isolated and opposed for years by the United States and Britain. But his movement could count on financial and political support from Gaddafi, who shared a desire to resist Western as well as Soviet meddling, a longing for more innately African institutions and a willingness to embrace violence in the pursuit of revolutionary ideals.

One of Mandela's most notorious allies may have been Robert Mugabe, who has ruled Zimbabwe for now 33 years. Half a century ago, when Mandela was not viewed as favorably in the West as he is today, but Mugabe was viewed perhaps more favorably, the two African liberation leaders were not so different. Both had embraced violence. Neighboring Zimbabwe, then known as Rhodesia, was a British colony that, like South Africa, had a powerful white minority ruling over a dispossessed black majority. After Mugabe took power in 1980, his government offered anti-apartheid movements crucial support, even sheltering anti-apartheid fighters in Zimbabwe's borders.

Even Syrian dictator Hafez al-Assad, whose son is today leading one side of the country's brutal civil war, could count on Mandela, whose government sold him $650 million worth of tanks in 1997.

Mandela never broke from Gaddafi and supported Mugabe for years. The shared experience of liberation had brought them together. But the South African leader diverged from them in how he led his country once he'd won liberation. Qaddafi amassed power for himself and imposed his ideology on Libya; Mugabe simply flipped Zimbabwe's racial government upside down, privileging blacks over whites instead of the other way around.

That Mandela broke from this is part of what makes his legacy so important. He fought not just for the liberation of blacks but, once he became president, for real pluralism and democracy that also served the whites who'd long benefited from apartheid. He left office after one term to help ensure that future leaders would feel pressure not to stay on long, as many African presidents do. He wasn't just bringing his ideals to South Africa, but proving to the world that liberation movements, present and future, really could be all that they promised.

Mandela did finally condemn Mugabe and call for him to leave office in the 2000s, but he remained a friend of some of the world's most notorious dictatorships because of those shared liberation roots. “Mandela was profoundly loyal to those who supported the liberation struggle, even if it was in their narrow self-interest to do so and when it had little or nothing to do with nonracial democracy,” John Campbell, a senior fellow at the Council on Foreign Relations, told my colleague Scott Wilson.

By the time Mandela became president in 1994, the Western world had embraced him and his movement, pulling post-apartheid South Africa closer to the United States and former colonial master Britain. But Mandela and his movement, the African National Congress, had suffered through its hardest decades despite Western opposition and with support from fellow liberation movements that, at the time, looked not so different from South Africa's.