The Obama White House genuinely believed the release of the American soldier who disappeared in 2009 in Afghanistan would provide a triumphant moment for the president and a moment for national unity.

Otherwise, there would have been no Rose Garden celebration featuring the president and Sgt. Bowe Bergdahl’s parents.

Some in the White House surely saw the Rose Garden bit as a chance to play rope-a-dope with their political adversaries after weeks of getting beaten up over the Veterans Administration scandal.

They might have calculated that a knee-jerk Republican offensive against the deal — Bergdahl in trade for five of the world’s worst terrorists — would backfire on an attack-dog GOP and thereby help the Democrats.

But that’s the problem with tactical ploys in the middle of a political fight. They may seem rational to you, but you might be punch-drunk, your vision clouded, your thought processes disturbed.

Given everything the administration knew about the five dangerous men it was releasing and the circumstances surrounding Bergdahl’s 2009 disappearance from his outpost in Afghanistan, you would’ve thought Obama and his people would be more circumspect about the deal they struck.

They’re not fools, to put it mildly.

The president and his advisers are very intelligent people with good poll data and a feel for what the American people think and want.

Obama believes that he has the public’s backing in his effort to extricate America from the 13-year-old War on Terror — Iraq, Afghanistan, the prison at Guantanamo and stated policies like “no negotiations with terrorists.”

He might have thought the Bergdahl-Taliban swap was a perfect blend of his policy interests and an example of the new way forward.

1) The fact that US forces are, at his direction, going to pull out from Afghanistan at the end of 2015 meant that sooner or later the five Taliban commanders were going to have to be removed from the Gitmo prison.

2) Their removal from Gitmo would help to make the case for shuttering it, as they were among the worst of the worst still there.

3) The ability to strike a deal with the Taliban would prefigure the kinds of negotiations he thinks we and the Afghan government are going to have to undertake over the next couple of years. If the resolution of this first negotiation were seen as successful, that might portend future successes.

4) The final US departure from Afghanistan couldn’t take place without bringing Bergdahl home — in part to prevent a repeat of the gruesome late ’70s/early ’80s fantasy that America had left POWs to rot in Vietnam.

5) Taken all together, this swap would be a potent demonstration that the centerpiece of the Obama foreign policy is the ending of wars — perhaps even, finally, the War on Terror, the detritus of which sits inside the fences at Gitmo. “This war, like all wars, must end,” the president said last year.

I think the connections here were entirely clear to him, and that he did see the Bergdahl swap as a triumph for which he deserved to take credit — and which he could use to demonstrate to the American people he cares deeply about our men and women in uniform.

That became necessary in the wake of the VA hospital scandal (a Washington Post poll yesterday reveals an astounding 79 percent believe he is personally responsible to some degree for it).

The allure of all this blinded Obama and his team to the cascade of horrified responses to the deal.

First was shock at the release of the terrorists and what it might mean for the safety of Americans and as a signal to the world about the US willingness to make unsavory deals.

Second was the even greater shock at the unfolding tale of Bergdahl’s 2009 disappearance — the rage of those who served with him, the blame they assigned him for the deaths of fellow soldiers and their belief that he had at best deserted and at worst had gone over to the enemy.

This was all predictable, but the White House did not predict it — perhaps because the president doesn’t understand that the American people still value honor over expediency.