The driving force behind President Obama's surprising decision to trade five Guantanamo Bay prisoners for Sgt. Bowe Bergdahl was his eagerness to trumpet positive news following a series of recent setbacks, said Republicans and Democrats alike.

But in doing so, he severely miscalculated the political ramifications of the illegal and dangerous move, critics contend.

“I think it's fair to say the White House wanted a win -- and ignored a bunch of obvious landmines in pursuit of that,” a senior aide to a Democratic senator told the Washington Examiner.

Many detractors are drawing a distinction between bringing Bergdahl home, which they say was a worthy undertaking, and giving up five high-level Taliban members for his return. Republicans and a growing number of Obama's own allies believe the released Gitmo prisoners will soon be back on the battlefield.

Military officials say Bergdahl willingly walked away from his base five years ago and was taken into captivity by the Taliban. Some of the troops stationed with Bergdahl said American soldiers were killed trying to find him.

By signing off on the Bergdahl trade, Obama also found a way to reduce the prison population at Guantanamo Bay -- though nearly 150 inmates still remain -- and bring the so-called last prisoner of war home ahead of a major troop drawdown in Afghanistan.

White House officials said that while they were bracing for a Gitmo debate and a clash over the legality of the president’s actions— Obama ignored the requirement to give lawmakers 30 days' notice of prison transfers— they were caught off guard by how the circumstances of Bergdahl’s disappearance sapped so much enthusiasm for the deal.

“We thought that bringing home an American would trump everything else,” explained one senior administration official. “We still would like to think that’s the enduring principle here.”

Still vexing, however, is just what prompted Obama to swiftly — and unilaterally — finalize a deal that for years seemed like too steep a price, even among many of his senior advisers.

In defending his controversial decision, Obama has repeatedly said that Bergdahl’s health was his primary motivation. Administration officials on Thursday said the Taliban had threatened to kill Bergdahl if details of the deal were leaked or if negotiations fell apart.

The White House was well aware that Bergdahl's fellow troops had labeled him a deserter but still chose the pomp of a Rose Garden ceremony over a quiet, more nuanced statement. National Security Adviser Susan Rice appeared on television the next day and insisted that Bergdahl had served with "honor and distinction."

Obama Thursday dismissed the latest debate about his competency, saying it was just a “controversy whipped up in Washington.”

“We saw an opportunity, we seized it,” he said during a press conference in Belgium. “And I make no apologies for it.”

Facing an onslaught of criticism, Obama’s inner circle has gone to great lengths to paint the president’s decision as one that was supported by his entire national security team. The not-so-subtle suggestion from the White House is that opponents of the Bergdahl swap are motivated purely by politics.

But it’s not that simple.

Former Obama CIA Director and Defense Secretary Leon Panetta this week said he opposed a similar deal discussed during his tenure.

“I just assumed it was never going to happen,” Panetta said of trading Bergdahl for five Gitmo prisoners.

“I don't fault the administration for wanting to get him back,” he explained during at an energy conference in Pittsburgh. “I do question whether the conditions are in place to make sure these terrorists don't go back into battle.”

Former Defense Secretary Robert Gates and former Secretary of State Hillary Clinton expressed similar reservations, according to multiple reports.

Obama's hastily arranged Rose Garden announcement, in which he was joined by Bergdahl's parents, came just a day after he accepted the resignation of Veterans Affairs Secretary Eric Shinseki. The White House had been on the defensive for weeks over revelations of deadly lapses in medical care at VA hospitals.

But rather than alleviate the VA problems, the Bergdahl episode gave the administration yet another headache involving members of the military.

Even before the public was given a fuller portrait of the Bergdahl trade, multiple polls gave Obama his lowest ratings ever for both for his management abilities and handling of international affairs.

And after learning of the White House’s latest defense, Republicans remain puzzled.

Rep. Justin Amash, R-Mich., said simply that the White House rationale “makes no sense.”