A Massachusetts wife-killer's push for a taxpayer-funded sex-change has been denied in a court decision that could end two decades of costly legal wrangling.

Michelle Kosilek, who was born Robert Kosilek and is serving life in an all-male prison for killing his wife in 1990, sparked outrage after winning a 2012 district court decision that ruled the operation must be covered by taxpayers. In that decision, U.S. District Court Chief Judge Mark Wolf also awarded Kosilek's defense team $724,000 in attorneys fees. But a federal appeals court ruled Tuesday that not providing treatment for Kosilek's alleged gender identity disorder did not violate the Eighth Amendment prohibition against cruel and unusual punishment.

"The district court erred and that the care provided to Kosilek by the DOC does not violate the Eighth Amendment," the court ruled. "We therefore reverse the district court's grant of injunctive relief, and we remand with instructions to dismiss the case," the court ruled.

The sex change operation would have cost approximately $50,000, according to Kosilek's attorney, Frances Cohen, who said it would be paid for under a contract the Department of Correction has with its medical provider.

The appeals court remanded the case to the lower court with instructions to dismiss the case. Kosilek could appeal to the U.S. Supreme Court.

Click for more from Boston Herald