The deal to exchange five high-level Guantanamo Bay detainees for POW Sgt. Bowe Bergdahl was reached a day before the swap was made last week, a U.S. senator told the Associated Press.

U.S. Sen. Dick Durbin, D-Ill., told the AP that Bergdahl’s location in Afghanistan was learned of just an hour before U.S. forces picked him up.

Bergdahl’s rescue became highly controversial as some accused the soldier of deserting the Army. Others condemned the prisoner swap because President Barack Obama did not give Congress 30 days’ notice of the exchange, which is required by law because it entailed the release of five Guantanamo Bay detainees.

Obama defended the move to free Bergdahl, saying the U.S. had a short window to act, citing the soldier’s deteriorating health. It was later revealed that the Taliban allegedly threatened to kill Bergdahl if news of the swap was leaked.

“Regardless of the circumstances, whatever those circumstances may turn out to be, we still get an American soldier back if he’s held in captivity, Obama said while in Poland last week. “We don’t condition that.”