One of the ironies of the praise offered by world leaders for Nelson Mandela at a state memorial service Tuesday is that the former South African president frequently irritated the United States and others with his policy positions and his loyalty to longtime supporters such as Cuba and Libya.

Cuban leader Fidel Castro and Libya’s Moammar Gaddafi had long supported the African National Congress (ANC). And as president, Mandela did not abandon them, despite their human rights abuses and Libya’s involvement in the 1988 bombing over Lockerbie, Scotland, in which a Pan Am transatlantic flight was destroyed, killing 270 people.

Mandela endorsed human rights as “the core of international relations” in an article in Foreign Affairs magazine just before taking office in 1994. But he also said in 1998: “My foreign policy is determined by the past. . . . The relations I have had with [a particular] country, the contributions they have made to our struggle.”

“We will never renounce our friends,” Mandela said in February 1996 during a visit to his former prison at Robben Island with Norwegian Prime Minister Gro Harlem Brundtland. He said he would invite Castro and Gaddafi to South Africa despite U.S. pressure to abandon his support for them.

Castro visited South Africa during a conference of nonaligned nations in 1998, but Gaddafi never came. Mandela visited Libya several times after his release from prison in 1990, partly to raise money for the ANC, according to a biography by the late British journalist Anthony Sampson.

At a soccer stadium in Johannesburg, South Africa, President Obama memorialized former South African president, Nobel Peace Prize laureate and anti-apartheid activist Nelson Mandela. (Associated Press)

“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,” said John Campbell, senior fellow for Africa policy studies at the Council on Foreign Relations.

Even the administration of President Bill Clinton, who attended the memorial service Tuesday, did not escape Mandela’s finger-wagging. In October 1997, as Mandela was preparing to visit Libya, the State Department said it would be “disappointed” if he went ahead. Mandela said at a banquet in Johannesburg, “How can they have the arrogance to dictate to us who our friends should be?”

When he visited and embraced Gaddafi, Mandela criticized “countries that play policeman of the world” and said that “those who object to my visiting Libya have no morals.”

Mandela and Clinton also differed over whether Egyptian politician Boutros Boutros-Ghali should be given another term as U.N. secretary general. Although Boutros-Ghali had widespread support, the Clinton administration blocked his reappointment. Mandela was, however, partly mollified by the selection of Kofi Annan from Ghana.

Another point of contention was a plan in early 1997 for the Armaments Corporation of South Africa to sell tanks worth $650 million to Syria, angering the United States and Israel. Again Mandela asserted his and South Africa’s right to go ahead.

“We will conclude agreements with any country whether they are popular in the West or not,” he said. “The enemies of countries in the West are not ours.”

Mandela remained a staunch supporter of Clinton despite the friction, and their personal relationship overshadowed their differences on diplomatic issues.

President George W. Bush also had a mixed relationship with Mandela on foreign policy. Jendayi Frazer, who was a member of the National Security Council under Bush and is now an Africa expert with the Council on Foreign Relations, said Sunday on “This Week with George Stephanopoulos” that Mandela had differed with Bush on the U.S.-led invasion of Iraq in 2003 but made common cause on other issues.

“In 2005, when they met again at the Oval Office,” Frazer said, “it was to reconcile the issue of how personal [a turn] the criticism in Iraq had taken, and, in fact, to look at where they had mutual interests, for instance, in addressing HIV and AIDS, supporting peace processes in central Africa, the Democratic Republic of the Congo and in Burundi.”

Mandela’s strong sense of loyalty also guided more than his foreign policy. “This loyalty was mirrored by his unstinting and uncritical loyalty to the ANC after he left office and as the party diverged from his path,” Campbell said. “It is as though he could not imagine those who had supported the ANC could be fundamentally undemocratic.”