The judge in a case of a trans woman prisoner serving a 73-year sentence has ruled that she should be evaluated for gender reassignment surgery.

US District Judge James C Turk, from Roanoke ruled that officials must grant Ophelia De’Lonta her right to be examined, following a lawsuit seeking the surgery.

On Wednesday Judge Turk granted the assessment at De’Lonta’s expense, noting that it was for valid legal discovery in order to support her lawsuit.

In the ruling, Judge Turk said the court “sees no harm to defendants from allowing this modest request”. He noted that prison officials had opposed the exam, but that no practical objection or safety concern was raised.

He did not rule on De’Lonta’s preliminary injunction request that the state pay for an official medical evaluation for her suitablity for the procedure, however, he noted that the state would most likely want her to be evaluated by a physician of its choosing.

During the hearing on Monday, De’Lonta’s lawyers argued the necessity of the evaluation to have the surgery, because of the harm she poses to herself without it.

The lawsuit claims that denying her the surgery is in violation of her Eigth amendment right against cruel and unusual punishment. The lawsuit estimates that the surgery can be done at a cost to the state of $20,000 (£13,000).

According to the Roanoke Times, a lawyer for the prison had said the state contests the suggestion in the lawsuit that it had not provided medically necessary care. The paper reported that the state argued that it had offered counselling, hormone treatment, and to allow De’Lonta to dress according to her gender identity.

The judge previously dismissed De’Lonta’s self-filed lawsuit back in 2011, after he concluded that the Virginia Department of Corrections was adequately treating her  for gender dysphoria.

A three-judge panel of the 4th US Circuit Court of Appeals in January sent her case back to the lower court, concluding that the claim should be heard.

Similar lawsuits have been filed in other US states, and some lawmakers have attempted to ban the use of taxpayer money for the operations.