By CHARLIE SAVAGE
WASHINGTON — The United States on Saturday transferred nine Yemeni detainees from its wartime prison at Guantánamo Bay to Saudi Arabia, completing a long-sought diplomatic deal ahead of a planned visit to Riyadh by President Obama in the coming week.
The effort to persuade the Saudi government to take the prisoners began in the Bush administration and finally resulted in an agreement in February. Current and former officials familiar with the negotiations called the timing of the transfer, which reduced the population at Guantánamo to 80 prisoners, a coincidence.
“There have been a lot of discussions with the Saudis over the last few years, and they have been emphatic that it was very important to close Guantánamo,” said Cliff Sloan, who served as the State Department envoy for negotiating detainee transfers in 2013 and 2014. “They wanted to help with that. But the one thing they weren’t willing to do for a long time was actually accept Yemenis. That’s why this is a major breakthrough.”
The military brought each of the prisoners from the Afghanistan War to the American naval base at Guantánamo about 14 years ago, soon after President George W. Bush’s administration opened the prison in early 2002. Later, the Bush administration decided to try to close it, a goal the Obama administration has shared.
But finding places to transfer the large number of lower-level Yemeni detainees there has been a significant obstacle. American officials have been reluctant to repatriate them because Yemen is chaotic and has an active affiliate of Al Qaeda.
But Saudi Arabia, which shares a border with Yemen, has a stronger government and security. It also operates a rehabilitation program for Saudis who have drifted into militant Islamism. The program tries to reverse their radicalization and help them reintegrate into peaceful society. It enlists their relatives to help and has a record of reducing — though not eliminating — the risk of recidivism, officials have said.
In 2007, a leaked diplomatic cable shows, American officials toured the Saudi rehabilitation center, which is named for Prince Mohammed bin Nayef, a top security official, and raised the possibility of transferring Yemeni detainees with relatives living in the kingdom to the center. But Prince bin Nayef, who is now the crown prince, “said this would not be possible, primarily for domestic political reasons,” according to the document.
When Mr. Obama became president in 2009 and vowed to close the prison at the Guantánamo military base in Cuba, there were 242 detainees, 99 of them Yemenis. In separate trips to Saudi Arabia that spring, John O. Brennan, then Mr. Obama’s top counterterrorism adviser, and Robert M. Gates, who was the defense secretary, again raised the idea, according to another leaked cable and news reports. They were again rebuffed.
As Mr. Obama’s first term unfolded, the effort to close the prison ground to a halt as Congress imposed steep restrictions on transfers. But in 2013, amid a widespread hunger strike by detainees, he resumed his push for transfers — and renewed talks with the Saudis about the Yemenis.
At that point, officials said, the main focus was an effort, led by the United Nations, to build a rehabilitation center in Yemen, where security conditions briefly appeared to be improving. The Saudis offered to help pay for a center. But Yemen soon resumed its downward spiral.
In late 2013, officials said, Mr. Sloan gave a list of 10 Yemenis with families in Saudi Arabia to a representative of Prince bin Nayef, who suggested that the families petition the Saudi government to take them. The Obama administration passed the word on to the detainees’ lawyers.
The administration also began working on resettling Yemenis in other places, starting with Eastern Europe in late 2014. In May 2015, when leaders of several Arab states visited Camp David, Mr. Obama privately urged them to take some Yemenis, officials said. Oman has since taken 20, and the United Arab Emirates five.
In July, Lee Wolosky succeeded Mr. Sloan at the State Department. In one of his first acts, he commissioned a seven-page report about the detainees with relatives in Saudi Arabia, officials said. The State Department passed the report to Saudi officials in August.
The administration’s revived attempt to engage Saudi Arabia over the Yemenis was part of Secretary of State John Kerry’s broader efforts to repair diplomatic relations after disagreements and tensions in recent years; he has visited Saudi Arabia five times since early 2015. The effort also followed the death of King Abdullah in January 2015 and the crowning of his successor, King Salman, who shuffled Saudi leadership.
King Salman visited the United States in September. During a meeting in the Oval Office, officials said, Mr. Obama urged taking the Yemeni detainees who had relatives in Saudi Arabia. The new king indicated that he was willing to consider the idea, and Mr. Obama dispatched Mr. Wolosky to Riyadh, the Saudi capital, in October.
“Lee did amazing diplomatic work in making the argument to the Saudis that some of the key successes of their rehabilitation program exist for the Yemeni detainees — like strong family ties,” said Daniel J. Rosenthal, who then worked on Guantánamo issues at the National Security Council.
Later in October, Mr. Kerry visited Saudi Arabia again, but was told only that the Interior Ministry was still looking at the request, officials said. But a positive sign came from Brian Neff, a lawyer for one of the Yemeni men, Mashur al Sabri.
After a parolelike board approved Mr. Sabri’s transfer last April, Mr. Neff drafted a petition for his family to send to the Saudi government, asking it to take Mr. Sabri. In October, his relatives told Mr. Neff that Saudi officials had visited them to study whether that plan would work.
On Jan. 23, during another visit to Saudi Arabia, Mr. Kerry met with the king’s 30-year-old son, Prince Mohammed bin Salman, who is now the defense minister, and Adel al-Jubeir, the foreign minister. At that meeting, the prince said the Saudi government had decided to proceed with the American request.
Mr. Wolosky returned to Saudi Arabia in early February to settle the details. But a new hurdle arose when the Saudi government said it needed a letter of consent from Yemen’s government. Because the government was in disarray — it had been pushed into exile in Riyadh by Houthi rebels — it was not clear how long it would take to get such a letter.
But the Yemeni ambassador to the United States moved quickly, obtaining a letter signed by Yemen’s foreign minister and emailing it to Mr. Wolosky on Feb. 8. Mr. Jubeir was in Washington and already scheduled to go to the State Department later that day, and Mr. Kerry handed the letter to him, officials said.
By March, Defense Secretary Ashton B. Carter had notified Congress that he was satisfied with security arrangements and would transfer nine of the men, setting off a 30-day waiting period. Administration officials are still deliberating over the 10th Yemeni.
Mr. Neff said his client, Mr. Sabri, was “ecstatic” when he learned he would be sent to Saudi Arabia. “That is where his loved ones are, and everyone recognized that as the most appropriate living situation for him,” Mr. Neff said. “He is anxious to get on with living a peaceful life.”
The transferred detainees also included Tariq Ba Odah, a hunger striker whom the military has been force-feeding for years. Last summer, he filed a lawsuit asking a judge to order his release for medical reasons.
After an internal debate, the administration decided to fight that request. Omar Farah, a lawyer for Mr. Ba Odah, called it “unforgivable” that the Obama White House had refused to concede the case in court last year and said that “until the very end, Mr. Ba Odah doubted he would be freed.”
The other detainees were Ahmed al Hikimi; Abdul Naser; Ali al Raimi; Mohammed al Hamiri; Ahmed Kuman; Abdul al Qyati; and Mansoor Qattaa.