If there were ever any checks on the erratic, impulsive Trump foreign policy, they nearly vanished last week.

President Trump's replacement of national security adviser H.R. McMaster with the uber-hawkish John Bolton practically guarantees that the president will walk away from the Iran nuclear deal in May. And Bolton's call for a preemptive attack on North Korea makes any prospects for a Trump-Kim Jong Un summit look slimmer than they already were.

Yet, the scariest thing about Bolton is this: His deep belief in military action will strengthen the president's most macho instincts. Especially since Trump just dumped Secretary of State Rex Tillerson in favor of another uber-hawk, ex-CIA Director Mike Pompeo.

Standing alone in the breach is Defense Secretary Jim Mattis, no wimp on using force, but a believer in trying all other options first. But Mattis is now bereft of cabinet allies.

We are about to see the real Donald Trump, unchained, in the foreign-policy arena — flexing his muscles at the world (minus Vladimir Putin). Barring some unexpected event — GOP senators waking up at the prospect of war? — the cost to America will be high.

Of course, if history is any guide, Bolton might self-destruct.

When he served in government, the walrus-mustachioed lawyer was so hard to work with that GOP senators blocked his confirmation as ambassador to the United Nations. (President George W. Bush gave him a recess appointment.) When he held a senior post at the State Department, Bolton clashed repeatedly with Secretary of State Condoleezza Rice and ultimately broke with Bush, whom he considered insufficiently hawkish.

But if he and Trump bond, Bolton's America First philosophy could give shape and consistency to Trump's most reckless instincts.

Bolton is a more serious and well-disciplined version of the chaotic former White House chief strategist Steve Bannon, or the president's first national security adviser, the wacko Mike Flynn.  They, too, tried to channel the president's go-it-alone impulses, but neither was skillful enough.

Along comes Bolton, who believes there is a yawning divide between "Americanists" and "globalists" (a term Bannon also used) who seek to tie the United States down, as the Lilliputians did to Gulliver.

In a speech in 2000 to the American Enterprise Institute, Bolton laid out how globalists seek to prevent America from using military force. He railed at all international organizations, multilateral treaties, the United Nations, nongovernmental and human-rights organizations, and any accord that constrained American power. "The costs to the United States … are far too great," he proclaimed.

So, it's no surprise that Bolton disdains the Iran nuclear accord and opposes negotiations with North Korea. Talks are not only useless, but should take a backseat to force.

One can assume the president approves of his new adviser's ideas on how to exit the Iran nuclear deal.

In March 2015, Bolton wrote an op-ed in the New York Times titled "To stop Iran's bomb, bomb Iran." It called on the Obama administration to bomb Iran's Natanz and Fordow uranium installations.

Last year, he wrote a detailed strategy in the National Review for quitting the Iran nuclear deal (which Trump is considering doing by a May 12 deadline). Besides renewing sanctions, the plan includes many elements aimed at facilitating regime change in Tehran. (Never mind that U.S. efforts at "regime change" boomeranged in the Iraq war that Bolton supported, and won't suceed in Iran.)

No surprise, Bolton totally downplays the consequences of trashing the deal, which would leave Tehran free to immediately advance toward nuclear breakout capacity. Nor does he mention that renewal of sanctions would lead to a clash with our European allies, who are party to the deal and want it to continue.

Or that it's awfully risky to put Iran back on the path to the bomb just when Trump is preparing to meet with the leader of North Korea.

Of course, Bolton is just as opposed to any deal with Pyongyang — and just as willing to use force to try to end the North Korean nuclear program. Consequences be damned.

"It is perfectly legitimate for the United States to respond to … North Korea's nuclear weapons by striking first," he wrote in the Wall Street Journal in February. "Given the gaps in U.S. intelligence about North Korea, we should not wait until the very last minute," he added.

Pompeo echoes Bolton.  He wants to roll back "the disastrous deal" with Iran, and said last year, on Fox News, that the only diplomatic option left with North Korea was "to end the regime." No details on how this plan comes to fruition.

Nor do Bolton and Pompeo dwell on the likely hundreds of thousands of dead South Koreans and U.S. troops in case of war with Pyongyang.

Until now, threats of preemptive war appeared to be pressure tactics aimed to squeeze and limit Iranian and North Korean nuclear programs. But the new Trump-Bolton-Pompeo troika seems committed to Iraq-like fantasies that war can solve all.

Unless Mattis or supine GOP legislators raise some roadblocks, this troika is heading for trouble. Expect a very difficult foreign-policy spring.

trubin@phillynews.com; @trudyrubin