This article was produced in partnership with the Pulitzer Center on Crisis Reporting.

GUANTÁNAMO BAY, Cuba — A judge has ruled against an Iraqi man held at Guantánamo Bay who wanted a federal court to intervene to improve his medical care and was seeking the appointment of an independent civilian doctor to oversee his treatment.

Lawyers for the prisoner, known as Abd al Hadi al Iraqi, 58, had filed the medical negligence case in 2017 after he underwent five spinal surgeries in nine months. Mr. Hadi is scheduled to go on trial in September on war crimes charges stemming from his alleged role as a commander of Taliban and Qaeda forces in Afghanistan.

But Judge Emmet G. Sullivan of the United States District Court in Washington ruled last week that Mr. Hadi had received adequate care from the military medical staff at Guantánamo.

“Detainees do not have a constitutional right to choose their own medical providers nor to obtain treatment of their own choosing,” Judge Sullivan wrote on Oct. 28 in dismissing the case.