The Defence Department violated U.S. law by failing to alert Congress before releasing five Taliban members held at Guantanamo Bay military prison in exchange for a captured U.S. soldier, a government watchdog agency said on Thursday.

The Government Accountability Office said the Pentagon broke the law by using money appropriated by Congress to carry out the transfer of Guantanamo prisoners without giving lawmakers the required 30-day notice.

"In addition, because DoD (the Department of Defence) used appropriated funds to carry out the transfer when no money was available for that purpose, DoD violated the Antideficiency Act" barring agencies from spending more than authorized, the GAO said in a letter posted on its website.

The GAO assessment had been requested by Republican lawmakers who were angered over the lack of notice they'd received about the U.S. decision in May to transfer five Taliban prisoners to Qatar in exchange for the release of Army Sergeant Bowe Bergdahl.

Senator Saxby Chambliss, vice chairman of the Senate Select Committee on Intelligence, said the GAO finding validated the view that President Barack Obama had "completely disregarded laws duly passed by Congress and signed by his own hand" by allowing a prisoner transfer that cost almost $1 million.

"This latest overreach regarding our national security has dangerous implications," Chambliss said in a statement. "The United States has a longstanding policy of not negotiating with terrorists for good reason, and these senior Taliban leaders will soon rejoin the fight."

But the Pentagon defended the transfer, insisting the prisoner swap to recover Bergdahl was conducted lawfully after consultations with the Justice Department.

"The administration had a fleeting opportunity to protect the life of a U.S. service member held captive and in danger for almost five years," said Rear Admiral John Kirby, the Pentagon press secretary. He said it was necessary to forego the notice to obtain Bergdahl's safe return.

Pentagon reason makes 30-day rule 'meaningless': watchdog

The Defence Department told the GAO that Defence Secretary Chuck Hagel authorized the exchange based on a section of the law that allows transfers of Guantanamo prisoners if actions are being taken to reduce the risk that they will re-engage in hostile activity.

The Pentagon told the GAO it did not believe the failure to give 30-days notice would make it unlawful to approve a prisoner transfer that was otherwise permitted under the law. And similarly, payment for the transfer would be lawful.

The GAO disagreed with the Pentagon's interpretation, saying it would essentially make the 30-day notification requirement "meaningless."

Bergdahl spent five years as a Taliban captive after walking away from his outpost.

His release was greeted by an initial wave of euphoria, but the prisoner swap deal triggered a backlash among U.S. lawmakers angry over the Democratic administration's failure to give 30 days notice as stated in the law. Some of Bergdahl's former Army comrades also charged that he had deserted.

Bergdahl spent several days at a U.S. military hospital in Germany before being returned to San Antonio, Texas, where he underwent further treatment. He has since returned to active military duty and is hoping to return to civilian life, his attorney said this week.

Army Major General Kenneth Dahl is currently investigating the circumstances surrounding Bergdahl's disappearance in Afghanistan and whether he broke any military regulations or laws. Dahl interviewed Bergdahl earlier this month and is expected to report on the case soon.