The Pentagon violated the law when it swapped a soldier held in captivity for five years in Afghanistan for five Taliban detainees without giving politicians sufficient notice, US investigators have found.

The Government Accountability Office (GAO) said that President Barack Obama's administration violated a law, which bars defence officials from using federal funds to transfer any Guantanamo detainees without giving key committees in Congress at least 30 days' notice.

The Department of Defence used $988,400 of its wartime funding for the transfer that freed Sergeant Bowe Bergdahl.

The GAO also said on Thursday that the department had spent money that was not "expressly appropriated for the purpose".

With a 2014 law, Obama gained some flexibility in transferring prisoners from the US detention centre at Guantanamo Bay, Cuba. But he was still required to notify Congress 30 days in advance.

The GAO said members of congress were advised by telephone of the decision to make the swap on May 31, the day it took place, and June 1, and received written notice on June 2, the AFP news agency reported.

At the time, Republicans, and even some of Obama's Democratic allies, fumed over what they considered a bad and dangerous deal.

The White House and Pentagon defended the transfer, arguing that protecting US lives was the executive branch's constitutional obligation.

They cited Bergdahl's rapidly deteriorating health and security to justify quick action and keeping Congress in the dark until the last minute.

"We believe it was lawfully done and lawfully conducted and this was a judgment shared with the Justice Department," Pentagon spokesman Rear Admiral John Kirby told CNN after the GAO released its findings.

Qatar-brokered deal

US Defence Secretary Chuck Hagel has said the deal brokered by Qatar represented the "last, best opportunity" to ensure Bergdahl's freedom.

Bergdahl disappeared from his post at a base in eastern Afghanistan in June 2009.

To get him back, five senior Taliban leaders were released from Guantanamo and sent to Qatar, where they are due to remain for one year.

The soldier has returned to duty by working a desk job at Fort Sam Houston in Texas. 

On Wednesday, his lawyer said Bergdahl wanted to leave the military and return to civilian life, the Reuters news agency reported.

"It is time for Sergeant Bergdahl to just become plain old Bowe Bergdahl and move on with his life," Eugene Fidell said.

He remains under investigation for leaving his unit in Afghanistan, and a US Army investigator began formal questioning of the former prisoner of war on August 6.

Source: Agencies