The Obama administration has prevailed in the first court challenge to its controversial force-feedings of detainees at Guantánamo Bay, even as the judge ruling in the government’s favor criticized its lack of “common sense and compassion”.

Gladys Kessler, a federal judge in Washington DC, denied Abu Wa’el Dhiab’s request to significantly change the manner in which the US military transfers, restrains and forcibly feeds detainees on hunger strike to protest their confinement. Kessler’s ruling, siding with the government in nearly every particular, is the denouement of a courtroom drama that in May saw a civilian judge ordering the military to briefly halt Dhiab’s forced feeding.

In October, the injunction sought by the Syrian detainee prompted an extraordinary three days of courtroom disclosures about the feedings, which the government had sought to keep secret.

Dhiab’s lawyers said they were considering an appeal.

Kessler’s ruling against Dhiab does not impact an associated disclosure ruling she has made, ordering the disclosure of videotapes depicting Dhiab’s forced removal from his cell by guards in riot gear and the insertion of feeding tubes into his stomach through his nostrils. The Justice Department has until 17 November to announce if it will appeal the decision or disclose the tapes; the Guardian is part of a coalition of news organizations that have filed briefs for the tapes’ release.

In ruling against Dhiab on Friday, Kessler demonstrated the myriad complications facing detainees who turn to US courts for relief against their US military captors.

Kessler appeared persuaded by written testimony from Guantánamo officials that leaving the feeding tube in for days on end, which Dhiab sought as a means to minimize pain, created a greater risk to detainees’ health and to that of Guantánamo nurses and guards.

“The government produced highly credible evidence that enteral feeding is rarely painful,” wrote Kessler, who in 2013 called the force-feeding “painful, humiliating and degrading”. While Kessler accepted that Dhiab had complained that the feeding is painful in “isolated incidents,” she found that the Guantánamo command had not demonstrated “deliberate indifference” to his suffering, the legal standard she accepted as controlling, despite the arguments of Dhiab’s lawyers.

Kessler declined to contradict the government on the necessity of its “restraint chair”, in which a detainee’s limbs and head are tied down for feeding, nor on its much-contested claims that it only feeds hunger strikers facing imminent and dire risk to their life or health. Dhiab stands over 6ft and weighs approximately 152lbs.

Kessler did not directly address a central claim from Dhiab’s attorneys: that the forced feedings are a form of punishment to break the Guantánamo hunger strikes, rather than a strict medical consideration.

Still, the judge slammed Guantánamo officials for initially depriving Dhiab of the use of a wheelchair to transport himself to and from the feedings, as well as an additional mattress to alleviate long-term back pain that the government itself prescribes morphine to treat.

“While the government ultimately – but only a short time before the hearing – allowed Mr Dhiab to use the wheelchair, thereby inducing him to comply with the force-feeding as he had agreed to do, common sense and compassion should have dictated a much earlier result,” Kessler wrote, noting the persistent difficulty for outsiders to understand “the atmosphere at Guantánamo Bay.”

Dhiab, whom Kessler called “a very sick, depressed and desperate man”, was cleared for release by the Obama administration in 2009. “One can only hope that his release will take place shortly,” Kessler wrote.

Alka Pradhan, an attorney for Dhiab with the human rights group Reprieve, said in a statement: “While we respectfully disagree with today’s decision, Mr Dhiab’s case has given us a deeper look at Guantánamo than ever before, including medical malpractice and egregious cruelty by the government which Judge Kessler highlights in her decision.

“Now more than ever, the American public must demand to see the force-feeding videotapes that the government is still fighting to keep secret.”