WASHINGTON (Reuters) - The U.S. Senate unanimously backed President Barack Obama’s nomination of Eric Fanning as secretary of the Army on Tuesday, making him the first openly gay leader of a U.S. military service branch.

Eric Fanning testifies before a Senate Armed Services Committee confirmation hearing on his nomination to be Secretary of the Army on Capitol Hill in Washington January 21, 2016. REUTERS/Kevin Lamarque

Fanning was previously undersecretary of the Air Force and chief of staff to Defense Secretary Ash Carter.

Fanning was confirmed by unanimous voice vote, eight months following his nomination, after Senator Pat Roberts said Deputy Defense Secretary Robert Work told him that it was now too late for the administration to transfer prisoners from the detention center at Guantanamo Bay, Cuba, to Roberts’ home state, Kansas.

Work did not confirm Roberts’ account of that conversation, saying that no option was off the table.

“I explained to Senator Roberts that we are trying to achieve the goal of closure with the support of Congress and we recognize that there is limited time left to achieve that support, both in terms of lifting Congressional restrictions and winning approval of funds to execute closure,” Work said in a statement.

Roberts had held up Fanning’s nomination for months to underscore his opposition to any possible transfer of detainees.

His opposition had frustrated fellow Republican John McCain, chairman of the Senate Armed Services Committee and a strong supporter of Fanning’s nomination.

On Tuesday, McCain and Roberts appeared in the Senate together as Roberts announced that he had released his “hold” on Fanning and spoken to Fanning.

McCain noted that this year’s National Defense Authorization Act ensures that the Obama administration does not have the authority to release or transfer Guantanamo detainees to the U.S. mainland.

Roberts said Work told him during a meeting last week that he would be unable to fulfill an order to move Guantanamo detainees to the United States before Obama leaves office in January 2017.

“The clock has run out for the president,” Roberts said.