The House voted Tuesday to formally rebuke the Obama administration for its handling of the controversial trade of American prisoner Bowe Bergdahl for five Taliban leaders held at Guantanamo Bay.

In a 249-163 vote, the House passed a resolution chastising the administration for failing to give 30-days’ notice to Congress about the exchange in May. The vote, held on Congress’ second day back from summer recess, comes after a watchdog agency last month found that the Pentagon broke the law by failing to give proper notice.

The vote also comes at a critical time for the administration as President Obama tries to rally international and congressional support for steps to combat the rising threat of Islamic State militants in Iraq and Syria.

The debate and vote coincided with a White House meeting in which the president was discussing his strategy with House and Senate leaders.

Democrats lamented the timing of the resolution but Republicans insisted that Obama clearly violated the law.

"The administration deprived Congress of the opportunity to consider the national security risk or the repercussions of negotiating with terrorists," said Rep. Howard "Buck" McKeon, R-Calif., chairman of the House Armed Services Committee.

Five senior Taliban were released from the U.S. prison at Guantanamo in exchange for Bergdahl, who had disappeared from his post in Paktika province in eastern Afghanistan on June 30, 2009. The five Taliban are to remain in Qatar for a year.

Republican lawmakers and some Democrats were angry with Obama and members of the administration for failing to notify them about the swap even as 80 to 90 members of the government knew of the exchange. The administration has offered a number of explanations for keeping Congress in the dark, saying concern about Bergdahl's health and safety required speedy action.

The administration also expressed concern that lawmakers would divulge details of the deal, scuttling it.

Rep. Adam Smith of Washington state, the top Democrat on Armed Services, said the president should have notified Congress, but Obama has said his constitutional authority as commander in chief superseded the law to apprise lawmakers.

The Government Accountability Office, though, in a legal opinion issued at the request of congressional lawmakers, said in August that the Defense Department violated the law by failing to notify key Capitol Hill committees at least 30 days in advance. Further, the report said the Pentagon broke another law by using funds that were not technically available.

The resolution, which lacks the force of law and won't be considered in the Senate, "condemns and disapproves of the failure of the Obama administration to comply with the lawful 30-day statutory reporting requirement in executing the transfer of five senior members of the Taliban from detention at United States Naval Station, Guantanamo Bay, Cuba."

The measure says these actions "have burdened unnecessarily the trust and confidence in the commitment and ability of the Obama administration to constructively engage and work with Congress."

The resolution does express relief that Bergdahl has returned safely to the United States.

The Joint Chiefs of Staff has unanimously supported the exchange, insisting that the United States has a sacred commitment to men and women who serve that it will never leave anyone behind on the battlefield. Army Gen. Martin Dempsey, the chairman of the Joint Chiefs, said the swap in May was "likely our last, best opportunity" to free Bergdahl.

Bergdahl is doing administrative duties at Fort Sam Houston in San Antonio while an investigation into how he was captured by the Taliban is conducted.

The Associated Press contributed to this report.