HONOLULU (Reuters) - U.S. President Barack Obama on Friday signed into law an annual defense policy bill, but in a lengthy statement he raised objections to parts of it, including policies blocking him from closing the detention center at Guantanamo Bay, Cuba.

U.S. Marines exit an amphibious assault vehicle during a simulated beach assault at Marine Corps Base Hawaii with the 3rd Marine Expeditionary Unit during the multi-national military exercise RIMPAC in Kaneohe, Hawaii, July 30, 2016. REUTERS/Hugh Gentry

Obama pledged in his 2008 presidential campaign to close the military prison, but his efforts have been blocked by mostly Republican opposition in Congress. The Democratic president has instead reduced the population there by transferring prisoners to other countries.

The administration recently told Congress it would move up to 18 more prisoners of the 59 remaining at Guantanamo before Obama leaves office next month.

“During my administration, we have responsibly transferred over 175 detainees from Guantanamo,” Obama said in the statement on Friday. “Our efforts to transfer additional detainees will continue until the last day I am in office.”

President-elect Donald Trump, who will be sworn in on Jan. 20, said during the campaign that he would keep the Guantanamo Bay facility open and vowed to “load it up with some bad dudes.”

The $618.7 billion defense spending bill passed by the Republican-controlled Congress this month was a compromise version that dropped controversial language requiring women to register for the draft.

But it kept some Republican-backed initiatives Obama had opposed. The legislation boosts military spending when there has been no similar increase in non-defense funding, and it bars closures of military bases even though top Pentagon officials say they have too much capacity.

House of Representatives Speaker Paul Ryan, a Republican, said on Friday the legislation would give U.S. troops a pay raise and praised the Guantanamo language.

“This ensures that, right up until his last hour in office, President Obama will not be able to transfer Guantanamo Bay detainees to the United States,” Ryan said in a statement.

Obama’s predecessor George W. Bush opened the facility to hold terrorism suspects rounded up overseas following the Sept. 11 attacks. Under Bush, the prison came to symbolize aggressive detention practices that opened the United States to accusations of torture.

Obama has maintained for years that he considers “onerous restrictions” on his ability to transfer prisoners a violation of the U.S. Constitution’s separation of powers between Congress and the executive branch. But he gave no indication he would try to override those restrictions.

Reflecting the growing migration of espionage and warfare into cyberspace, Obama also said on Friday that he favors splitting the U.S. Cyber Command, which conducts offensive operations, from the National Security Agency and making it independent, similar to the military’s European and Pacific Commands.