Former Secretary of State John Kerry admitted to meeting Iranian Foreign Minister Mohammad Javad Zarif “three or four times” since leaving office. Seeking to preempt criticism that his talks violated US laws prohibiting private citizens from advising or negotiating with foreign states, he said he merely wanted to see “what Iran might be willing to do in order to change the dynamic in the Middle East.”

Even if Kerry violated no laws, a more self-aware statesman would recognize that such freelance diplomacy weakens the US, emboldens enemies and has a track record of failure.

Consider North Korea: Bill Clinton’s presidency, like Trump’s, began with a North Korea crisis. Clinton had been president barely a month when North Korea refused International Atomic Energy Agency inspections and, weeks later, announced that it would withdraw from the Nuclear Non-Proliferation Treaty.

After Clinton declared, “North Korea cannot be allowed to develop a nuclear bomb,” former President Jimmy Carter traveled to Pyongyang on an ostensibly personal visit to try to right what he believed was Clinton’s unnecessarily inflexible policy. He met with North Korea’s absolute dictator Kim Il -sung and, without authorization, promised not only would the White House abandon its drive for UN sanctions, but also conceded North Korea the right to reprocess nuclear fuel rods — in effect giving Pyongyang enough plutonium to construct five nuclear bombs. Carter had pulled the carpet out from the international pressure campaign Clinton sought to build.

Then there was Syria: Bashar al-Assad’s government was an unrepentant terror sponsor. It facilitated Hezbollah’s rearmament in defiance of UN resolutions after, in July and August 2006, Hezbollah launched much of its missile arsenal at Israel. As insurgency raged in Iraq, evidence mounted as to Assad’s culpability.

In one raid on insurgents, US forces found a laptop that contained a database showing conclusively that most foreign fighters and suicide bombers entered Iraq via Syria, with the full complicity of the Syrian government. Meanwhile, Assad covertly worked with North Korea to build a plutonium processing plant.

Like Clinton with North Korea, President George W. Bush believed the best course of action was to isolate Syria. To partisans, however, “cowboy” Bush was the real problem.

Enter Nancy Pelosi. Defying Bush, the then-majority leader decided to break the diplomatic embargo. Pelosi traveled to Damascus, posed diligently for photos and declared, “We came in friendship, hope, and determined that the road to Damascus is a road to peace.” It wasn’t.

In the wake of her visit, Assad doubled down on defiance and repression and, eventually, the pressure cooker he created exploded. Pelosi today recognizes her mistake, as she no longer brags about cultivating a man subsequently responsible for a half million civilian deaths and the use of more chemical weaponry than any leader since World War I.

Kerry seems unwilling to learn such lessons. After all, Iran isn’t his first freelance attempt: During the Vietnam War, his antics emboldened the enemy while Americans were still in harm’s way.

More recently, just weeks into Barack Obama’s presidency, he became the first US lawmaker to visit Gaza in nearly a decade. Congressmembers had avoided the area for the simple reason that it was run by Hamas, an unrepentant terrorist group committed to genocide and responsible for the murder of Americans.

Hamas was thrilled. “We believe Hamas’ message is reaching its destination,” Ahmed Yusuf, Hamas’ chief political adviser, said. In effect, Kerry legitimized Hamas, reinvigorated it and made himself its postman.

Back to Iran: When, in 2015, Sen. Tom Cotton and 46 other senators sent an open letter to its leaders warning them that absent Senate ratification the nuclear deal would not survive the Obama administration, Kerry quipped that the senators’ actions were an “unconstitutional, un-thought-out action.”

Of course, they were neither. Kerry’s castigation of Cotton, however, simply makes Kerry’s more covert and repeated outreach to Iranian officials more hypocritical. Even assuming Kerry is well-meaning, his naiveté is astounding. Zarif arose in a system where freelancing insures imprisonment if not death and so may project officialdom onto Kerry even when there is none.

Regardless, the basis of Trump’s strategy — like that of Clinton and Bush before him — is to coerce concession through isolation. Every president has the right to craft his own strategy. For a former secretary of state to knowingly undercut that suggests antipathy toward democratic outcomes. Perhaps it is that tendency, however, that best explains Kerry’s bizarre affinity toward Tehran.

Michael Rubin wrote “Dancing with the Devil,” a history of US diplomacy with rogue regimes.