Pentagon officials broke the law by trading five imprisoned Taliban leaders for captured U.S. Army Sgt. Bowe Bergdahl without notifying Congress at least 30 days in advance and by using appropriated public funds for a different purpose, the nonpartisan Government Accountability Office said Thursday.

"Our opinion in this matter rests upon the Secretary of Defense’s responsibility to comply with a notification condition on the availability of appropriations to transfer individuals from Guantanamo Bay. This opinion does not address the Secretary’s decision to transfer the five individuals in this case as part of DOD’s efforts to secure the release of an American soldier. However, when DOD failed to notify specified congressional committees at least 30 days in advance of its transfer of Guantanamo Bay detainees to Qatar, DOD used appropriated funds in violation of section 8111 [of the fiscal 2014 Defense appropriations law]," GAO General Counsel Susan A. Poling wrote in a letter to Senate Minority Leader Mitch McConnell, R-Ky., and Senate Appropriations Committee Republicans.

"As a consequence of using its appropriations in a manner specifically prohibited by law, DOD violated the Antideficiency Act. ... DOD should report its Antideficiency Act violation as required by law."

President Obama announced May 31 that Bergdahl, who walked away from his base and was captured in 2009, had been traded for the five Taliban leaders and was coming home. The Army is investigating the circumstances of his disappearance.

The swap was immediately controversial, and many Republican lawmakers suggested it was illegal. Defense Secretary Chuck Hagel defended the administration's actions in a June 11 hearing of the House Armed Services Committee, saying the opportunity to free Bergdahl in a deal mediated by the government of Qatar was extremely limited and any leak would have endangered it.

"In the decision to rescue Sgt. Bergdahl, we complied with the law. And we did what we believed was in the best interest of our country, our military, and Sgt. Bergdahl," Hagel said.