The Senate confirmed the long-stalled nomination of Eric Fanning to be Army secretary, making him the first openly gay leader of a U.S. military service.

The voice vote approval on Tuesday came after Sen. Pat Roberts, R-Kan., dropped his opposition to Fanning after a senior Pentagon official told him that no detainees held at Guantanamo Bay, Cuba, would be sent to the Army prison at Fort Leavenworth, Kansas, or other facilities in the United States.

Roberts said he met May 10 with Deputy Defense Secretary Robert Work, who assured Roberts "that, 'I am the person who would have to execute it (the moving of detainees to the mainland), and the clock has run out.'"

Congress has included prohibitions on moving Guantanamo detainees to the U.S. in annual defense policy bills, thwarting President Barack Obama's campaign promise to close the prison.

Roberts said he knows Obama will continue to try and close prison at Guantanamo before he leaves office in January, but said he takes Work at his word.

"He understands the significant and costly changes that would need to be made at Ft. Leavenworth to change the post's mission," Roberts said. "Most importantly, he understands the legal restrictions on funding to move the detainees to Ft. Leavenworth by January 20, 2017."

Fanning served as the Army secretary's principal adviser on management and operation of the service, with a focus on the budget. He was undersecretary of the Air Force from April 2013 to February 2015, and for half a year was the acting secretary of the Air Force. He also worked on Defense Secretary Ash Carter's transition.