A hospital had the right to fire a male nurse for having consensual sex with a patient two days after she underwent heart surgery, a state appeals court ruled Thursday.

The Commonwealth Court decision overturned an arbitrator's ruling that had reinstated the nurse.

The patient had double bypass surgery at Temple University on July 13, 2006, and had sex with nurse Richard Baldwin sometime around 4 a.m. on July 15, according to the opinion.

Hospital investigators said the patient indicated she was attracted to Baldwin and that the medications she was taking had nothing to do with what happened.

Baldwin gave conflicting statements about the encounter to hospital investigators and the arbitrator.

He testified before the arbitrator that he did not have sex with the woman, but investigators said he told them that the woman had come on to him and that he was being fired for having consensual sex.

Even if it was consensual, the sex act was a violation of state nursing standards and hospital policy, hospital officials argued.

Judge Doris A. Smith-Ribner, writing on behalf of a unanimous three-judge panel, agreed and concluded that the arbitrator made troubling and serious errors.

"The arbitrator emphasized that he found a contradiction as to who initiated the sexual encounter, which could not be resolved because the patient did not testify," she wrote. "As the applicable regulations make plain, and as should be immediately obvious, the question of who initiated the encounter has no bearing at all on whether Baldwin violated the regulations."

Jonathan K. Walters, attorney for the Temple University Hospital Nurses' Association, said Thursday the union will have to decide whether to pursue an appeal to the state Supreme Court. He said the Commonwealth Court panel exceeded the scope of its authority.

"They hammered the arbitrator, but you know, they're not the arbitrator," Walters said. "He heard the evidence and he made the decision, and that's supposed to be the standard."

Temple University Hospital lawyer Joe H. Tucker Jr. said he would comment after reading the opinion.