Charlie Savage / New York Times News Service

Two Chinese Muslim detainees held for years without trial at the prison at Guantánamo Bay, Cuba, were released in El Salvador this week, the Pentagon announced Thursday. It was the first prisoner transfer out of Guantánamo in more than a year.

The detainees, both ethnic Uighurs, had been ordered freed by a federal judge several years ago on the ground that, although captured in Afghanistan, they were not enemies of the United States.

“We’re just happy for them both,” said Sabin Willett, a lawyer who helped represent both men at various stages of their habeas corpus lawsuits.

The U.S. government did not identify the men, but Willet said they are Ahmed Mohamed and Abdul Razak. Mohamed wants to become a salesman or merchant in El Salvador, Willet said. He said he did not know Razak’s plans, having never spoken in person with him.

The Bush administration sent 22 ethnic Uighur prisoners from Afghanistan to Guantánamo about a decade ago. Five were released to Albania in 2006, but after a judge ordered the remaining 17 released in 2008, the U.S. government struggled to find a place to send them.

They could not be repatriated, out of fears that the Chinese government, which is suppressing a separatist movement among Uighurs in the Xinjiang region, would abuse them. China, which had demanded custody, pressured other countries not to take the men.

Early in 2009, the Obama administration came close to resettling several Uighurs in the United States, but dropped those plans after a political uproar.