Leaders from across the world will gather in South Africa this week to pay tribute to the most extraordinary leader of our lifetime, Nelson Mandela. The chorus of tributes, from across the globe and across the political spectrum, cannot hope to do justice to this remarkable man, who emerged from 27 years in prison with a grace, dignity and will sufficient to transform the brutal apartheid system peacefully and spread hope across the world.

But Mandela was not always universally praised. In fact, U.S. administrations of both parties were far from ardent opponents of South Africa’s apartheid regime or supporters of Mandela and his organization, the African National Congress (ANC). Conservatives in particular long saw the apartheid regime as an anti-communist bulwark in the Cold War. After Mandela was sentenced to life in prison, the conservative National Review magazine defended South African courts for sending up “a batch of admitted terrorists to life in the penitentiary.” Conservative Russell Kirk opined that democratic rule in South Africa would bring “the collapse of civilization,” and the resulting government would be “domination by witch doctors … and reckless demagogues.”

President Richard Nixon and his secretary of state, Henry Kissinger, believed the apartheid regime was an essential ally that was here to stay, arguing in a secret National Security Council policy study — dubbed the “Tar Baby” report — that the United States shouldn’t risk getting stuck in support of the oppressed majority.

Ronald Reagan branded the ANC a terrorist organization while dismissing apartheid as more of a “tribal policy than a racial policy.” He advocated “constructive engagement” with the regime, calling for closer trade relations while opposing economic sanctions. The emerging new right gleefully joined in labeling the ANC and other African liberation movements communist, while promoting their own “freedom movements,” largely tribal and racialist alternatives. Jack Abramoff, later infamously indicted for illegal lobbying and financial frauds, became president of the International Freedom Foundation, later exposed as a front group for the South African Army, established to discredit the ANC as communists and terrorists. Grover Norquist and others mobilized to counter the divestment movement. (Norquist sported a bumper sticker saying “I’d rather be killing commies.”) In 1990, when Mandela was released from prison and traveled to the United States, the Heritage Foundation called him a terrorist.

Mandela and the ANC enraged the Cold Warriors. The ANC was allied closely with the South African Communist Party (indeed, the latter was a significant factor in keeping the ANC a multiracial party). The Soviet Union and Cuba provided external support. Mandela refused to disavow the use of violence against the repressive apartheid regime, even when offered an earlier release from prison. Upon his release, Mandela continued to embrace Castro as a “source of inspiration.” He remained a severe critic of Israel, condemning its treatment of the Palestinians. When he opposed Bush’s war on Iraq, National Review contributor Dave Kopel condemned his “long standing dedication to Communism and praise for terrorism.”

In 1985, the ANC called for U.S. sanctions against South Africa, arguing that the apartheid regime show no sign of changing. The movement to get American institutions and businesses to disinvest from South Africa — led by student and religious activists — spread across the country. President Obama remembers giving his first political speech for the cause.

But the movement was initially scorned as extreme and unrealistic. Moderates and the U.S. business community rallied around the “Sullivan principles,” named after the Rev. Leon Sullivan, a board member of General Motors, who tried to develop a code of conduct for businesses investing in South Africa.

In 1985, 180 House members (including 45 Democrats) voted against a nonbinding resolution calling on the apartheid regime to release Mandela. The naysayers included Dick Cheney and John McCain. In 1986 the Congress eventually passed economic sanctions over Reagan’s veto, and the pressure created the conditions for Mandela’s release and South Africa’s redemption.

This history has particular relevance now. Americans should not forget how our ideological anti-communist fervor blinded us to apartheid’s brutalities, as well as that of other dictatorships. Even as we claimed to be the champion of freedom, we were happy to embrace apartheid in the cause of anti-communism, and to compromise our principles to our interests. Across the world, the United States is now engaged in a war on terrorists, often fought with deadly drones targeting from afar. Too often we overlook or, worse, are complicit in the repression that drives people to violent resistance. Too often we fail to see that one person’s terrorist is another’s freedom fighter. It is worth remembering that the ANC stayed on the terrorist list until 2003, forcing Nelson Mandela to get a special waiver when he traveled here. And that Dr. Martin Luther King Jr., like Mandela, was denounced as a communist and a terrorist, and hunted by the FBI.

So as we celebrate the extraordinary life and triumphs of this special man and remarkable leader, we should not forget that our national security agencies got him and his movement wrong. And Cold Warriors in both parties chose to close their eyes to apartheid in the name of anti-communism. It took citizen activists, a global movement, horrible sacrifice by the South African people and a courageous leader and his team to force the change.

Read more from Katrina vanden Heuvel’s archive or follow her on Twitter.