The five Guantanamo detainees released by the Obama administration in exchange for America’s last prisoner of war in Afghanistan, Sgt. Bowe Bergdahl, are bad guys. They are top Taliban commanders the group has tried to free for more than a decade.

According to a 2008 Pentagon dossier on Guantanamo Bay inmates, all five men released were considered to be a high risk to launch attacks against the United States and its allies if they were liberated. The exchange shows that the Obama administration was willing to pay a steep price, indeed, for Bergdahl’s freedom. The administration says they will be transferred to Qatar, which played a key role in the negotiations.

In the initial statements released about the deal, the White House declined to name the detainees who would be leaving the Cuba based prison Obama has been trying to close since his first day in office.

A senior U.S. defense official confirmed Saturday that the prisoners to be released include Mullah Mohammad Fazl, Mullah Norullah Noori, Abdul Haq Wasiq, Khairullah Khairkhwa and Mohammed Nabi Omari.

While not as well known as Guantanamo inmates like 9-11 mastermind Khalid Sheikh Mohammed, the Taliban 5 were some of the worst outlaws in the U.S. war on terror. And their release will end up replenishing the diminished leadership ranks of the Afghan Taliban at a moment when the United States is winding down the war there.

“They are undoubtedly among the most dangerous Taliban commanders held at Guantanamo,” said Thomas Joscelyn, a senior editor at the Long War Journal who keeps a close watch on developments concerning the detainees left at the Guantanamo Bay prison.

Fazl, for example, was the Taliban’s former deputy defense minister and is wanted by the United Nations for his role in massacres targeting Afghan’s Shi’ite Muslim population.

According to the 2008 Pentagon’s dossier on Fazl disclosed by Wikileaks (PDF), Noori also was a senior Taliban military figure and, according to his Pentagon dossier, was asked personally in 1995 by Osama bin Laden (PDF) to participate in an offensive against northern alliance warlord Rashid Dostum.

Wasiq, a former deputy minister of intelligence, at one point tried to cooperate with U.S. forces in Afghanistan and asked for a GPS system as well as a special radio to communicate with the U.S. military after the U.S. invasion in 2001. His dossier (PDF) says that he was a crucial liaison between the Taliban and other Islamic fundamentalist groups while he was deputy intelligence minister. But the 2008 report also said he was holding out information he had on other top al Qaeda and Taliban leaders during interrogations.

Khairkhwa, a former Taliban governor of Herat, was considered by the Pentagon’s 2008 dossier to be a likely heroin trafficker (PDF). That dossier also says he likely participated in meetings with Iranian officials after 9-11 to help plot attacks on U.S. forces following the invasion.

Iran has worked in some cases with the government that has replaced the Taliban in Afghanistan, but also has been accused by the U.S. military of supplying the Taliban and other insurgent groups with roadside bombs known as improvised explosive devices of IEDs.

Nabi held several military leadership posts for the Taliban and helped organize the al Qaeda/Taliban militias that fought against U.S. and coalition troops in the first year of the war, according to his Pentagon dossier (PDF).

This week’s secret diplomacy was not the first time the U.S. government had engaged the Taliban in an effort to negotiate a prisoner swap for the release of Bergdahl. In 2011, State Department officials held a series of meetings with Taliban leaders in Doha.

In Congress, there was bipartisan opposition to any release of Guantanamo prisoners. After the negotiations were made public in early 2012 by Sen. Dianne Feinstein the Taliban announced they were pulling out of the talks.

In the summer of 2013, the U.S. attempted a Taliban confidence building measure, the opening of a Taliban representative office in the diplomatic enclave inside Doha, Qatar. Karzai was also mistrustful of that effort and his skepticism was validated when the Taliban violated their agreement with the U.S. and raised their flag at the office’s opening, causing Karzai to have a fit and forcing the U.S. to abandon the deal to keep the Taliban office open.

Talks resumed in late 2013 and the Taliban provided a video proof of life to the U.S. military in December 2013, which had been a condition for the U.S. to continue with the negotiations.

Many in Congress will still be opposed to the swap, but lawmakers gave up their right to stop it. A small change in the Fiscal Year 2014 National Defense Authorization Act (NDAA), which passed last December, now makes it only a requirement that the Defense Secretary notify Congress when releasing Guantanamo prisoners. Before the change, Congressional sign off on any Guantanamo releases would have been needed.

At about 10:30 am eastern standard time, Bergdahl was released from his captors. The handover was peaceful and happened in eastern Afghanistan along the border, according to a senior U.S. Defense official. U.S. special operations forces conducted the rescue.

The official said that once he was on the helicopter, Bergdahl wrote on a paper plate (writing instead of talking because it was so loud) “SF?” The operators sitting with Bergdahl responded loudly, saying, yes, we’ve been looking for you for a long time. Bergdahl broke down crying, the official relayed.

In exchange for Bergdahl’s release, five detainees at Guantanamo Bay will be released to Qatar. The US has “appropriate assurances” that Qatar will be able to secure the detainees there, a U.S. official said. The detainees are under a travel ban for a year.

The transfer took place quickly without incident, peacefully and without violence. There were approximately 18 Taliban on site.

U.S. officials believe Bergdahl had been held for the bulk of his captivity in Pakistan. They’re not sure when he was moved to Afghanistan.

The transfer was not negotiated with the Haqqani network, a network of former Pakistani defense officials and other designated terrorists. Instead it was brokered through the Qatari government.

Bergdahl’s parents happened to be in Washington when the news broke. They had come from their home in Idaho for Memorial Day.

Bergdahl is currently being held at a forward operating base in Afghanistan. He will be there until doctors are ready to let him go, and his next move will be to Bagram only when he’s ready.

The U.S. official praised this operation as a show of interagency cooperation—it was a whole-government effort that he said had been in the works for five years. “We really got traction in the last week but we never lost sight of Bergdahl,” he said.