U.K. Prime Minister Theresa May on Wednesday criticized populists and those who engage in “absolutism” in her final speech as prime minister -- as she defended her own desire for compromise in political negotiations.

“Today an inability to combine principles with pragmatism and make a compromise when required seems to have driven our whole political discourse down the wrong path,” she said in a speech at Chatham House, London.

TRUMP CALLS THERESA MAY 'FOOLISH' ON BREXIT, BLASTS 'WACKY' AND 'POMPOUS' UK AMBASSADOR

“It has led to what is in effect a form of absolutism – one which believes that if you simply assert your view loud enough and long enough you will get your way in the end,” she said. “Or that mobilizing your own faction is more important than bringing others with you.”

She went on to say that populist movements have “seized the opportunity to capitalize on that vacuum.”

“They have embraced the politics of division; identifying the enemies to blame for our problems and offering apparently easy answers,” she said. “In doing so, they promote a polarised politics which views the world through the prism of ‘us’ and ‘them’ – a prism of winners and losers, which views compromise and cooperation through international institutions as signs of weakness not strength. “

The remarks are likely to be seen as something of a veiled swipe at a number of populist leaders including President Donald Trump, with whom relations have dramatically deteriorated in recent weeks after the recent leak of diplomatic cables critical of Trump and penned by the U.K. ambassador to the U.S.

Trump blasted May’s handling of Brexit as “foolish,” in reference to her inability to get her withdrawal agreement, negotiated with the E.U. leaders, through Parliament. It was this failure that ultimately led to her resignation.

“I told @theresa_may how to do that deal, but she went her own foolish way-was unable to get it done. A disaster!” Trump tweeted last week, apparently referring to past advice that she sue the E.U.

May will be replaced by next week by the winner of the Conservative Party leadership contest -- widely expected to be former Foreign Secretary Boris Johnson, who is considerably more pro-Trump and has won the president’s backing.

May could have had Johnson in mind, who has taken a more populist approach to Brexit and has criticized May and threatened to pull Britain out of the E.U. with or without a deal on October 31 should he succeed her. She may also have been referencing Brexit Party leader Nigel Farage -- who has been similarly critical of May’s Brexit handling. However, she later said her remarks were not aimed at anyone in particular.

WATCH: TRUMP SAYS U.S. 'NOT BIG FANS' OF DARROCH

She defended her approach to the negotiations, and blamed those who took politics “back into its binary pre-referendum positions -- a winner takes all approach to leaving or remaining.”

"And when opinions have become polarized -- and driven by ideology -- it becomes incredibly hard for a compromise to become a rallying point."

In her remarks, May did not mention Trump by name, but did explicitly defend the U.K.’s participation in the 2015 Paris Climate Agreement and the Iran nuclear deal -- two compacts from which Trump has withdrawn the U.S.

“Once again it took painstaking pragmatism and compromise to strike that deal,” she said about the Iran deal.

CLICK HERE TO GET THE FOX NEWS APP

She also cited as support U.S. President Harry Truman’s outreach to the U.S.S.R. in negotiations about the U.N. Charter, and also remarks by President Dwight Einsehower on the importance of compromise.

“People talk about the middle of the road as though it were unacceptable...Things are not all black and white. There have to be compromises,” she quoted the former president. “The middle of the road is all of the usable surface. The extremes, right and left, are in the gutters.”