Former President Barack Obama criticized President Donald Trump indirectly in a speech in South Africa on Tuesday — but at times, he sounded almost like a conservative.

Obama attacked “populism,” and implicitly attacked Trump’s immigration and climate policies.

But he also found common ground with Trump his party, declaring: “Government exists to serve the individual, and not the other way around.”

It was a far cry from Obama’s statist dogma while in office, when he mocked what he called the “rugged individualism” of America: “It doesn’t work. It has never worked,” he said in 2011.

Obama was delivering the annual Nelson Mandela lecture, hosted by the Nelson Mandela Foundation, the charity founded by the late South African president. This year, the lecture marked Mandela’s centenary.

In his remarks, Obama sought to explain the present political moment, which he called “strange and uncertain.”

Obama began by arguing that “the international order has fallen short of its promise” because of vast inequality. As a result, he said, “we now see much of the world threatening to return to an older, a more dangerous, a more brutal way of doing business.”

The reason, he said, was that despite great progress over the last century, “the previous structures of privilege, and power, and injustice and exploitation never completely went away. They were never fully dislodged.”

In addition to old power structures, Obama said that the progress of humanity had obscured “signs of a brewing backlash,” including terrorism. He also said, to applause, that the U.S. invasion of Iraq “didn’t help, accelerating a sectarian conflict.”

In the U.S. and European Union, challenges to globalization began on the left, he said, but continued on the right — “often cynically funded by right-wing billionaires intent on reducing government constraints on their business interests,” he claimed.

The “reckless behavior of financial elites” that led to the 2008 financial crisis, he said, had been especially important. (He gave his own administration credit for “aggressive steps” that helped restore the global economy to “healthy growth.”)

The result, he said, was that “strongman politics are ascendant, suddenly, whereby elections and some pretense of democracy are maintained — the form of it — but those in power seek to undermine every institution or norm that gives democracy meaning.”

In remarks that many journalists interpreted as a swipe against U.S. President Donald Trump, Obama said:

In the West, we’ve got far-right parties that often times are based not just on platforms of protectionism and closed borders, but also on barely hidden racial nationalism. Many developing countries now are looking at China’s model of authoritarian control combined with mercantilist capitalism as preferable to the messiness of democracy. Who needs free speech as long as the economy’s going good? The free press is under attack. Censorship and state control of media is on the rise. Social media, once seen as a mechanism to promote knowledge and understanding and solidarity, has proven to be just as effective in promoting hatred and paranoid and propaganda and conspiracy theories.

Obama said he believed in Nelson Mandela’s vision of “equality and freedom and multiracial democracy,” and that “a world governed by such principles is possible, and it can achieve more peace, and more cooperation in pursuit of a common good.”

There was no choice but “to move forward,” he said. The challenge, he said, was “the power of fear … the lasting hold of greed, the desire to dominate others, in the minds of many — especially men.” Humanity had to overcome racial and religious differences, he said.

Economic inequality, he added, was a danger to democracy, even if it did not involve “straight-out corruption,” because rich people could use their money to govern.

He mocked the wealthy — including himself: “Right now, I’m actually surprised by how much money I got. … There’s only so much you can eat! There’s only so big a house you can have!” he said, to laughter from the crowd. Obama urged the wealthy to pay more in taxes: “Let me pay more in taxes! I can afford it!”

Obama, drawing on Mandela’s own remarks, counseled against discrimination of any kind. “We should do unto others as we would have done to us,” Obama said.

In another apparent swipe at Trump, Obama said, ad-libbing: ‘Don’t you get a sense sometimes … that these people who are so intent on putting people down and pumping themselves up that they’re small-hearted? That there’s something they’re just afraid of?”

He blamed immigration laws that, he said, were based on race, or ethnicity, or religion, and implicitly criticized Trump’s enforcement of existing laws, which until recently involved detaining adults separately from children with whom they crossed the border illegally. (The Obama administration had followed the same procedure — at least when it enforced the laws — as mandated by the law and the courts.)

Obama criticized the idea that society would achieve justice just by changing the color of the people in charge, drawing cheers from a predominantly black audience weary of the failures of the post-apartheid government. He also criticized countries that merely saw democracy as a process of voting without building or maintaining democratic institutions and liberties.

Obama also encouraged tolerance for people with different views, urging his audience not to “disregard what your opponents have to say from the start.”

He went on, however, to say that he saw no point in talking with people who denied climate change. “We have to believe in an objective reality. … You have to believe in facts. Without facts, there’s no basis for cooperation. … I can find common ground with those who oppose the Paris Accords … I can’t find common ground if somebody says climate change is just not happening, when almost all the world’s scientists tell us it is.”

Obama slammed those who denied “objective truth.”

Obama — whose repeated statement, “If you like your health care plan, you can keep it,” was dubbed PolitiFact‘s “Lie of the Year” in 2013– stressed the point..

“People just make stuff up. … Political leaders … they’re caught in a lie, and they just double down and lie some more.”

He concluded by insisting that cynicism could be overcome. “We’ve been through darker times.” He urged his audience to follow Mandela’s example of using love to overcome hate.

Joel B. Pollak is Senior Editor-at-Large at Breitbart News. He is a winner of the 2018 Robert Novak Journalism Alumni Fellowship. He is also the co-author of How Trump Won: The Inside Story of a Revolution, which is available from Regnery. Follow him on Twitter at @joelpollak.