President Obama on Wednesday signed a $607 billion defense policy bill despite his opposition to restrictions in the legislation that ban him from moving Guantanamo Bay detainees to the United States and making good on a long unfulfilled campaign promise.

Obama has opposed provisions preventing detainee transfers since Congress first attached the measures to spending bills in an attempt block Obama's plans. The dispute has taken on added intensity this year because the White House has launched a final push to close to the prison before Obama leaves office.

In a statement, Obama said the bill "includes vital benefits for military personnel and their families, authorities to facilitate ongoing operations around the globe, and important reforms to the military retirement system" as well as other measures.

He added, however, that he is "deeply disappointed that the Congress has again failed to take productive action toward closing the detention facility at Guantanamo." Keeping the prison open, Obama said, "is not consistent with our interests as a Nation and undermines our standing in the world."

The White House and the Pentagon are preparing to send to Congress a plan outlining more precisely how it would shutter the prison and where in the U.S. might transfer detainees. The proposal, however, was not expected to overcome sizable opposition among Republicans and some Democrats.

That's put the defense policy bill at the center of the debate over whether Obama would move some detainees from the detention center in Cuba to U.S. facilities without congressional approval. Some legal experts and Obama administration allies argue the restrictions are unconstitutional and are urging Obama to move the detainees and close the prison despite the provisions. The White House has said it is focused on working with Congress, but has not ruled out other options.

"As I have said repeatedly, the executive branch must have the flexibility, with regard to the detainees who remain at Guantanamo, to determine when and where to prosecute them, based on the facts and circumstances of each case and our national security interests, and when and where to transfer them consistent with our national security and our humane treatment policy," Obama said in the statement.

But after Obama signed the bill, House Speaker Paul Ryan, R-Wis., said his approval "reaffirms longstanding prohibitions on the transfer of Guantanamo Bay detainees to the United States."

The legislation will guide Pentagon policy for nearly all of the remainder of Obama's tenure. In addition to the detainee ban, it includes a 1.3 percent pay increase for service members, authorization for lethal assistance to forces fighting Russian-backed rebels in Ukraine and funding to help Iraqi forces fight Islamic State militants.

Obama vetoed an earlier version of the bill over a dispute — later resolved — about the way defense programs would be financed. He did not repeat the threat over the Guantanamo provisions, mindful that he would not have the votes to sustain a veto. The legislation passed with overwhelming support in both the House and Senate approval.

The White House announced the signing Wednesday afternoon along with five other bills.Obama has signed a $607 billion defense authorization bill despite his objection to provisions that ban him from moving Guantanamo Bay detainees to the United States. 

As a candidate, Obama promised to close the prison immediately if he was elected. But opposition from Congress to moving detainees to the U.S. has thwarted his attempts for years. 

The White House has promised to make a final push to close the prison before Obama leaves office. 

The defense policy bill had become a flash point in the debate over whether Obama can move some of the remaining 107 detainees from the detention center in Cuba without congressional approval.