John Bolton had to know he was sending a message to the man who pushed him out of the White House.

And a strong message it was, disagreeing with the president on just about every foreign policy hot spot.

The recently departed national security adviser was speaking to a Manhattan luncheon for the Gatestone Institute, a conservative think tank he once chaired. About 60 people were gathered at Le Bernadin, including such hotshots as Alan Dershowitz, former attorney general Michael Mukasey and Newsmax chief Chris Ruddy.

So the leak, in this case to Politico, was inevitable. The former Fox News contributor certainly gets that any words uttered before such a large audience will soon find their way into print.

SIZE MATTERS? MEDIA PRAISE ELIZABETH WARREN -- AND HER CROWDS

What’s fascinating here is that the Bolton broadside comes as Trump’s handling of the latest showdown with Iran is drawing increasing media criticism, especially from the right. The president is essentially in a no-win situation, whether he chooses a military strike against Iran or sticks with diplomacy and sanctions. The neocon wing of the GOP wants him to retaliate for the attack on Saudi oil facilities that our intel agencies are blaming on Iran, and is casting his reluctance as a sign of weakness.

Bolton told the luncheon that any negotiations were Iran (and North Korea) are “doomed to failure,” according to Politico.

“Bolton also said more than once that Trump’s failure to respond to the Iranian attack on an American drone earlier this summer set the stage for the Islamic Republic’s aggression in recent months…Bolton said the planned response had gone through the full process and everybody in the White House had agreed on the retaliatory strike. But ‘a high authority, at the very last minute,’ without telling anyone, decided not to do it.”

Reporters quickly asked Trump for his response. “John was not able to work with anybody, and a lot of people disagreed with his ideas,” he said. “A lot of people were very critical that I brought him on in the first place because of the fact that he was so in favor of going into the Middle East, and he got stuck in quicksand and we became policemen for the Middle East. It’s ridiculous.”

SUBSCRIBE TO HOWIE'S MEDIA BUZZMETER PODCAST, A RIFF OF THE DAY'S HOTTEST STORIES

The president was referring to the Iraq war and Bolton’s role in the Bush administration. Trump ran against that war, and endless wars, and obviously wants to get out of Afghanistan.

The neocons are growing more critical of Trump’s reluctance to pull the trigger in these situations. He even got into a little spat with his pal Lindsey Graham, who said, like Bolton, that the president’s failure to strike back after Iran downed an American drone is what paved the way for the attack that cut Saudi oil production in half.

The Beltway press, as part of an establishment whose kids are rarely sent off to fight, often reflects these pro-war instincts. Iraq, you’ll recall, was going to be a cakewalk.

Bret Stephens, a conservative New York Times columnist who detests the president, wrote yesterday that Trump’s policy is “locked, half-cocked, and probably bluffing.” He said this president combines “the rhetorical impulses of Bob Dornan with the strategic instincts of Dennis Kucinich.”

Trump does like to talk tough with foreign adversaries. And obviously he has ordered airstrikes before. But it’s no accident that he threatened to incinerate North Korea and wound up in a pen pal relationship with Kim Jong-un.

And yet if he keeps turning to sanctions and diplomacy, does there come a point where he looks like Barack Obama and his Syrian red line?

Trump is bound to disappoint the neocons by exercising restraint when it comes to military options, knowing full well that there are unintended consequences that could bog down U.S. troops for years to come. That means he’s likely to face continued criticism from John Bolton, but might be in tune with the war-weary portion of the country.