BOSTON – A convicted murderer in Massachusetts who won the right to get a state-funded sex change is also eligible to have legal fees — expected to top $500,000 — paid, a federal judge has ruled.

In a landmark decision, U.S. District Judge Mark Wolf earlier this month ordered the state Department of Correction to provide sex-reassignment surgery to Michelle Kosilek.

Wolf found that prison officials had violated Kosilek’s Eighth Amendment right to protection against cruel and unusual punishment, and that the surgery is the “only adequate treatment” for Kosilek’s gender-identity disorder. Wolf has now found that Kosilek is also entitled to legal fees.

“Kosilek has prevailed on his claim that the defendant has violated his Eighth Amendment rights and is continuing to do so. Therefore, he is eligible to be awarded his reasonable attorney’s fees and costs,” Wolf wrote.

Wolf’s ruling does not say how much in legal costs Kosilek is eligible for; the case dates back years and the amount is “likely to be large,” Wolf wrote.

Kosilek’s attorney, Frances Cohen, said she has not yet done a final calculation or submitted a request for fees, but she estimates that attorneys’ fees will be comparable to the approximately $500,000 sought by another transgender inmate who sued the Department of Correction for treatment of gender-identity disorder.

Cohen said she and another lawyer who worked on Kosilek’s case have offered to forego their fees if the Department of Correction agrees not to appeal Wolf’s ruling. The lawyers would still seek reimbursement for an undetermined amount paid in out-of-pocket expenses, including the fees paid to their experts.

DOC spokeswoman Diane Wiffin said the department is reviewing Wolf’s ruling on legal fees. She said the department has not made a decision yet on whether to appeal Wolf’s ruling ordering sex-reassignment surgery for Kosilek. The department has until Oct. 9 to file a notice of appeal.