WASHINGTON — When Prime Minister Matteo Renzi of Italy visited the White House in October for a state dinner, he made a commitment to President Obama: Italy, which resettled a Yemeni detainee from Guantánamo Bay last summer, would take one more person on the transfer list. But before the deal was completed, Mr. Renzi resigned.
So a day after his successor, Paolo Gentiloni, formed a government on Dec. 14, Secretary of State John Kerry called to congratulate Mr. Gentiloni — and to urge him to follow through on the commitment, according to an official familiar with the negotiations. Mr. Gentiloni agreed, leading a rush to finalize the details and paperwork.
The effort was part of a burst of urgent, high-level diplomatic talks aimed at moving as many as possible of Guantánamo’s 22 prisoners who are recommended for transfer. By law, the Pentagon must notify Congress 30 days before a transfer, so the deadline to set in motion deals before the end of the Obama administration was Monday.
By late in the day, officials said, the administration had agreed to tell Congress that it intended to transfer 17 or 18 of the 59 remaining detainees at the prison; they would go to Italy, Oman, Saudi Arabia and the United Arab Emirates. If all goes as planned, that will leave 41 or 42 prisoners in Guantánamo for Donald J. Trump’s administration. Mr. Trump has vowed to keep the prison operating and “load it up with some bad dudes.”
Obama administration officials agreed to speak about the transfers on the condition of anonymity to discuss diplomatic talks and congressional notifications that are not public.
The Bush administration brought about 780 men to Guantánamo after the Sept. 11, 2001, attacks, saying that it could hold Qaeda suspects there in indefinite wartime detention without trial — a move that the Supreme Court eventually approved — and that it could disregard the Geneva Conventions in how it treated them, which the court rejected.
President George W. Bush started trying to close the prison in his second term and bequeathed 242 detainees to Mr. Obama. If the proposed transfers go through, the 41 or 42 prisoners Mr. Trump would inherit include 10 men who were charged or convicted in the military commissions and 27 who have not been charged but are deemed too dangerous to release.
The latter group includes a few people accused of links to significant attacks, like the 2002 nightclub bombings in Bali, Indonesia, but for whom courtroom-admissible evidence is thin, and others who are not linked to any attack but who, officials believe, remain committed to Islamist militancy.
That would leave the last four or five men on the transfer list. They include an Algerian, a Moroccan and a Tunisian whom the administration was reluctant to repatriate for reasons having to do with their home countries, officials said, and a stateless Rohingya man whom no country offered a home.
All have been imprisoned for nearly 15 years. While a parole-like board put the first two on the transfer list only recently, a 2009 task force had put the latter two on the transfer list seven years ago. Their fates are now uncertain.
It is not clear whether Mr. Trump will refuse to transfer any remaining detainees — a step many Republicans denounced whenever Mr. Obama did it — or continue to use the parole-like review boards that periodically consider moving detainees onto the transfer list.
Obama officials credit that review process for a drop in the recidivism rate among former detainees. Of Bush-era transfers, 35 percent are confirmed or suspected of re-engaging in militancy; of Obama-era transfers, the combined figure is 12 percent, according to the Office of the Director of National Intelligence.
Matthew G. Olsen, the former National Counterterrorism Center director who led the task force in 2009 that initially reviewed and recommended what to do with each of the then-remaining detainees, said nearly eliminating the transfer list was a major accomplishment.
“There is a humanitarian imperative not to detain people who can be safely transferred to their home country or to another country, and much of what we have seen over the past few years has been continued detention for many such people,” he said.
Most who would be transferred next month are Yemenis. Because conditions in Yemen are chaotic, the Bush and the Obama administrations were reluctant to repatriate Yemeni detainees, so they stayed behind as others from more stable countries went home.
The Obama administration did not try to resettle them in its first term, hoping Yemen would stabilize. It finally gave up and began resettling Yemenis in late 2014.
Then, that July, several events helped set the conditions to turn such talk into transfers. First, the administration appointed Lee Wolosky to fill the vacancy as the State Department special envoy for Guantánamo closure, a role that had been open for six months; his Pentagon counterpart was Paul Lewis.
Then, Mr. Wolosky met with Susan E. Rice, the national security adviser, and they developed a plan to speed up the process by imposing a one-month deadline on the Pentagon to act on any proposal. Under law, the secretary of defense must approve any transfer; both Chuck Hagel, the former secretary, and Ashton B. Carter, who took over in early 2015, went through periods when they were slow to act.
Later that month, at a National Security Council Principals Committee meeting, the White House presented Mr. Carter with a memo imposing the deadline. According to several witnesses, he reacted angrily. But the Pentagon soon began moving more swiftly, including by starting its review of proposals without waiting for other agencies to sign off first, officials said.
At the time, Mr. Kerry was in Europe completing the Iran nuclear deal. After he returned, he called Mr. Wolosky into his office and they agreed to make sustained diplomatic engagement on transfers a priority. Mr. Wolosky also obtained the authority to offer assistance to defray resettlement during negotiations, in the range of $100,000, out of a Pentagon contingency fund without waiting for permission, officials said.
Those events set the stage for the final push. Some detainees went to Europe, but the largest batches went to the Gulf nations, which the administration — attracted by the idea of sending Yemenis to a place with a shared language and capable internal security agencies — repeatedly asked for more help.
In an interview, Mr. Wolosky said that even if Mr. Trump fills the prison back up, he does not consider his efforts to have been in vain “because detainees are not fungible.”
“Looking at these cases on an individualized basis was the right thing to do legally and morally,” he said. “A number of detainees the United States government unanimously decided years ago it no longer needed to detain were finally and responsibly released from U.S. custody. That is irreversible, regardless of what policy the next administration pursues.”