A new congressional report is critical of the Obama administration’s decision to trade five Taliban prisoners held at Guantanamo Bay for Army Sgt. Bowe Bergdahl. And the report ascribes a political motivation to the prisoner swap, according to two sources familiar with the document’s contents.

Administration officials have long said that the exchange of Taliban prisoners for Bergdahl, who disappeared from his base in eastern Afghanistan in 2009 and was held for five years by a Taliban affiliate, was conducted under a long-standing tradition of trading prisoners at the end of military hostilities.

“We have an unwavering commitment and patriotic duty to leave no man or woman in uniform behind on the battlefield,” a senior administration official told The Daily Beast, without commenting directly on the report, which was written by the Republican staff of the House Armed Services Committee. (The Democrats were reviewing the document Monday evening.)

“We had a near-term opportunity to save Sergeant Bergdahl’s life, and we were committed to using every tool at our disposal to secure his safe return,” the official said.

But before the Bergdahl trade, senior U.S. intelligence officials had also told members of Congress that the Taliban fighters were likely to return to hostilities against the United States if they were released. The fighters were placed under house arrest in Qatar for one year, but that did little to dampen criticism that the administration had taken a risk releasing the men.

The new report is likely to reignite the controversy around the administration’s decision and Bergdahl’s case, which has figured in a vitriolic presidential election season. The sources said that it raises the question of whether the administration was motivated to release the five prisoners as a way of reducing the prisoner population at Guantanamo. The Obama administration has been searching for a place to house the remaining prisoners outside the island prison, and the issue has become a political albatross for the president, who promised from his first days in office to close the facility.

The leading Republican presidential candidate, Donald Trump, has repeatedly called Bergdahl a traitor who abandoned his post and endangered other troops who tried to rescue him. Trump has even suggested Bergdahl should have been shot in the head.

The swap has also been roundly criticized by Republican lawmakers, including Sen. John McCain, the chairman of the Senate Armed Services Committee, who said recently that Bergdahl was “clearly a deserter” and promised hearings if the Army chose to follow the advice of one of its lawyers that Bergdahl should serve no jail time and shouldn’t face disciplinary actions.

In March, the Army charged Bergdahl, 29, with desertion and misbehaving before the enemy. He’s currently serving at Fort Sam Houston in San Antonio, Texas.

The full scope of the House Armed Services Committee report, which hasn’t been previously reported, was unclear. But sources said it examines the U.S. government’s efforts to win Bergdahl’s release. Those efforts have also been criticized by current and former officials for not ensuring that the various agencies of government that play a role in hostage rescue were working in concert.

Two Defense Department officials confirmed to The Daily Beast that the Pentagon has been providing information to the committee for its report. However, they said they hadn’t seen the document, which is expected to be released Tuesday.

However, those officials denied any suggestion that the Defense Department’s goal was anything but Bergdahl’s safe return. The five-for-one prisoner swap “was the best deal we could get for Bergdahl,” a senior defense official said.

But there were efforts underway at the time to bring Bergdahl home as well as other Americans held by the same group that had imprisoned him, the Taliban-aligned Haqqani network.

“The five-for-one swap was the starting point for what’s become the administration’s backdoor effort to thin out the inmate population at Gitmo,” Joe Kasper, a spokesperson for Rep. Duncan Hunter, told The Daily Beast. Hunter, a member of the Armed Services Committee, has been a leading critic of the administration’s hostage recovery efforts and is particularly critical of the Bergdahl exchange.

“What we’ve always known—and hopefully this report provides the right validation—is that the five-for-one swap was a less than half-baked idea that was favored by the State Department and the rest of the administration to the detriment of other, more acceptable and viable options,” Kasper said, referring to attempts to rescue Bergdahl as well as other American hostages held along the border with Afghanistan and Pakistan.

Some Defense officials conceded that the release of the five Taliban prisoners did help reduce the population at Guantanamo Bay by bypassing the approval of often reluctant defense secretaries who have refused to release detainees to other countries. But the officials stressed that emptying the prison was never a primary goal.

The Government Accountability Office has already determined (PDF) that the swap broke federal law because the administration didn’t provide adequate notice to Congress.

According to one source familiar with the committee’s work, the report’s authors examined other efforts to rescue Bergdahl, including a failed operation by a non-Defense Department agency. Two sources familiar with the operation said that agency was the FBI. In February 2014, the Bureau sent personnel to the Pakistan side of the Afghanistan-Pakistan border to wait for Bergdahl, who they erroneously believed was about to be freed.

Bergdahl’s lawyer, Eugene Fidell, declined to comment about the House Armed Services Committee report, saying he was not familiar with it. A spokesperson for the committee also declined to comment.

While lawmakers have objected to the trade, it wasn’t exactly a surprise at the time. U.S. intelligence officials briefed members of Congress on a potential swap at least two years earlier, said a former senior intelligence official who was directly involved in the talks.

The official and a colleague told lawmakers that the five Taliban prisoners were likely to return to hostilities if they were freed.

But at the time, the administration also sought to portray the swap as part of a broader effort to bring hostilities with the Taliban to a close, and not just a one-time prisoner exchange, the former official said. A trade was worth the potential controversy, the logic went, if it helped bring peace to Afghanistan.

“We were really talking about getting into negotiations with the Taliban over ending the war. This was briefed [to Congress] in the context of a confidence-building measure,” the former official said.

But that plan got derailed, he noted, when Afghanistan’s president, Hamid Karzai, became enraged over U.S. attempts to negotiate with the Taliban.

The plan to ultimately do the trade for Bergdahl was drawn up by a working group of deputy-level officials, led by then-White House deputy national security adviser Denis McDonough, the former official said. Principal-level officials were “heavily involved” in the process and eventually signed off on the swap, he said.

McDonough is now Obama’s chief of staff.

Privately, officials told The Daily Beast that the deal for Bergdahl was fraught with politics. Some thought that without Bergdahl’s release, the U.S. couldn’t withdraw all troops from Afghanistan, which was the administration’s plan around the time of the deal. Obama has since decided to keep a residual military force of about 9,800 personnel in Afghanistan through much of 2016, in light of the rapid gains made by jihadist militants from the so-called Islamic State after the U.S. withdrew combat forces from Iraq.

The military’s efforts to rescue Bergdahl at the time of his disappearance, amid suspicions he walked off base, made his capture divisive from the beginning. Some of Bergdahl’s fellow soldiers have said that the Army risked lives trying to rescue a potential deserter. President Obama announced the trade and Bergdahl’s release in a May 2014 Rose Garden address, flanked by Bergdahl’s parents.

Other efforts were underway to bring Bergdahl home as part of a broader effort to rescue Americans held hostage by Islamic militants in the region along the border of Afghanistan and Pakistan. It’s not clear to what extent the House Armed Services Committee report examines them, but they have figured prominently in congressional testimony.

In June, Lt. Col. Jason Amerine, a decorated combat veteran and Green Beret, testified at a Senate hearing that while serving in the Pentagon, he and his colleagues had designed a plan to trade Bashir Noorzai, an Afghan drug dealer serving a prison sentence in California, for American and Canadian hostages, including Caitlin Coleman and her husband, Canadian Joshua Boyle, who were kidnapped while hiking in Afghanistan in 2012. Coleman gave birth to a child while in captivity.

Warren Weinstein, an American contractor, was also part of the planned trade.

But the State Department intervened and stopped the deal, Amerine testified. Instead, the administration traded the five Taliban prisoners only for Bergdahl.

Weinstein was killed in a U.S. drone strike in Pakistan this year.

The Daily Beast reported this month that at least one more American is being held by the Haqqani network.

Amerine said that the FBI accused him of misconduct for sharing what it claimed was classified information about the possible multi-prisoner deal with Hunter, the congressman and hostage-rescue critic. Amerine was eventually cleared of all accusations of wrongdoing and given the Legion of Merit before retiring from the Army last month.

The release of Bergdahl may have opened a kind of Pandora’s box, signaling to hostage takers that the United States was willing to trade a disproportionate amount of its own prisoners for American citizens.

For instance, before he was released from a U.S. maximum-security prison this year, Ali Saleh Al-Marri, a confessed al Qaeda sleeper agent, was offered up in a potential prisoner swap that would have freed two Americans held abroad.

The Daily Beast previously reported that the proposal was floated in July 2014 to the then-U.S. ambassador in Qatar by an individual acting on behalf of that country’s attorney general. According to two individuals with direct knowledge of the case, the proposition was made shortly after the Obama administration traded the five Taliban fighters for Bergdahl.

A U.S. official said at the time that Al-Marri’s release was part of an agreement with Qatar and that no exchange ever occurred.