WASHINGTON — A federal judge reversed an order that had prevented the Pentagon from force-feeding a detainee at Guantánamo Bay, Cuba, saying she “simply cannot let (him) die.”

But in ending her weeklong ban on the force-feeding of Abu Wa’el Dhiab, U.S. District Judge Gladys Kessler sharply criticized the U.S. military for not allowing him to be fed in a base hospital, as he requested, and instead requiring that he be strapped down at the prison compound.

Lawyers for Dhiab, also known as Jihad Ahmed Mujstafa Diyab, have been trying for nearly a year to get federal courts to halt the feeding against their will of Guantánamo detainees who have launched hunger strikes to protest their open-ended incarcerations.

Dhiab, 43, a Syrian, has been cleared for release by the Pentagon’s Guantánamo Review Task Force. But despite an offer from Uruguay to take him, the Obama administration has not released him after more than 11 years in custody at Guantánamo.

Kessler ordered the military May 16 to stop force-feeding Dhiab, the first time a federal judge had directly intervened in the forced feeding of Guantánamo prisoners. The Pentagon obeyed and Dhiab continued his hunger strike.

In a ruling released late Thursday, Kessler said Dhiab’s “physical condition was swiftly deteriorating, in large part because he was refusing food and/or water.” She said she was “faced with an anguishing Hobson’s choice”: whether to again temporarily bar the Pentagon from force-feeding him, knowing it could have disastrous effects. There is, she said, “the very real probability that Mr. Dhiab will die.”

She noted that Dhiab was willing to be fed at the U.S. naval-base hospital on the island, something the military refuses to do. If it could be done, she said: “He could be spared the agony of having the feeding tubes inserted and removed for each feeding, and he could be spared the pain and discomfort of the restraint chair.”

Pentagon officials said they would not allow detainees to starve themselves to death. They justified the force-feeding practice, known as “enteral feeding,” as necessary to protect the health of detainees who go on hunger strikes.

On Friday, Kessler ordered the government to provide her with the detainee’s medical records by June 10.