"She has been a model prisoner," Cohen said.
The Department of Correction had argued that prison officials were concerned about protecting Kosilek from sexual assault if she were allowed to complete her transformation into a woman.
But Cohen told the court that Kosilek has received female hormone treatments and has lived at the state prison in Norfolk for more than 20 years "without incident."
McFarland, however, cited testimony from prison officials who said they were concerned about sending Kosilek back to the male prison after surgery. He disputed Wolf's finding that the security concerns expressed by prison officials were "either pretextual or can be dealt with."
The appeals court panel took the case under advisement and is expected to rule within three months.
After the hearing, Cohen said the various treatments Kosilek has received have not been enough to ameliorate her disorder.
"I think the Eighth Amendment imposes an obligation to provide medical services," Cohen said.
She said the surgery, which can cost anywhere from $10,000 to $50,000 or more, would be paid for under a contract the Department of Corrections has with its medical provider. The contract is based on the number of inmates, not the number of medical procedures provided, so would not increase the state's costs, she said.
"There's been no showing (the surgery) would move the needle at all," she said.