In the first public testimony on the matter by a senior Obama administration official, Defense Secretary Chuck Hagel today defended the decision to free Army Sgt. Bowe Bergdahl in a trade for five Taliban leaders, and said the president acted within his legal authority in not notifying Congress that the exchange would happen.

Hagel told the House Armed Services Committee that he regrets President Obama acted without Congress. However, he said, “extraordinary circumstances”–such as Bergdahl’s declining health and demands from Qatari negotiators that the deal not be leaked–required unilateral action.

“I would never sign any document or make an agreement that I did not feel was in the best interest of this country,” said Hagel, who confirmed Obama made the final decision to free Bergdahl, with the backing of his intelligence staff.

“We could have done a better job of keeping you informed,” he told the lawmakers. “But I assure you this was done legally. This was a tough call. I supported it. I stand by it. I take that responsibility [as defense secretary] damn seriously. Damn seriously.”

Hagel avoided speculation about how Bergdahl was captured in June 2009 after leaving his base. He said Bergdahl would be questioned upon his return to the U.S.

“Wars are messy and full of imperfect choices,” Hagel said. “The bottom line is we don’t leave people behind. That is the beginning and end of what we stand for.”

Hagel, a Vietnam War veteran and former Republican senator from Nebraska, said he understood the risk in freeing the Taliban leaders from Guantanamo Bay–some of whom had been held captive since 2001. But, he said, he confirmed that none of those freed was implicated in a specific act of terror against the U.S.

“We are not under any illusions about these detainees,” Hagel said. “If they try to rejoin the fight, they are doing so at their own peril.”

Hagel gave a detailed timeline for the process of freeing Bergdahl to illustrate the haste with which he said Obama had to act, and how Congress had been aware of negotiations for some time.

Congress was briefed on negotiations in November 2011 and January 2012, before the Taliban broke off talks that March.

That was the last Congress heard of a possible exchange before the Taliban released Bergdahl on May 31.

In September 2013, the government of Qatar offered to be an intermediary in the talks. By the end of the year, the Obama administration asked for a “proof of life” video,  and received it in January.

On May 12, the administration signed a memorandum of understanding with Qatar, detailing how the detainees could not leave the Persian Gulf state for a year after being freed.

“We received warning from Qatari intermediaries that time was not our side,” Hagel said. “We felt this was our last chance to get him.”

The administration agreed to a deal May 27, but did not move ahead with the transfer until May 31.

“We did not know the location [of the transfer] until one hour before,” Hagel said. “We did not know until the moment he [Bergdahl] was handed over that the Taliban would hold up their end of the deal.”

Hagel said the Department of Justice confirmed the administration acted within the National Defense Authorization Act of 2014, which requires 30 days notice to Congress before the government transfers a Guantanamo detainee, because intelligence officials determined potential risks posed by the freed prisoners were “substantially mitigated.”

House members told Hagel they understood the delicacy of the negotiations, but felt their trust had been violated.

“I don’t envy the situation you have been put in, but members on this committee trust each other to live up to their word and we have to trust he [Obama] will follow laws we agree to,” said Rep. Buck McKeon, R-Calif., the committee’s chairman.

McKeon said the deal would “incentivize” militants to capture other American troops.

Hagel also answered another major question that has followed Bergdahl’s release: He said there is no evidence any soldier died looking for Bergdahl.