Two foreign language teachers fired from their Brooklyn high school for having a romantic tryst in a classroom were punished too harshly and are entitled to teaching jobs, a state appeals court ruled Thursday.

Cindy Mauro, left, and Alini Brito were treated too harshly when the New York City Department of Education fired them over an alleged classroom tryst, an appellate court ruled Thursday.New York Daily News | CBS New York screen capture

Alini Brito, 34, a Spanish teacher, and Cindy Mauro, 38, who taught French, were fired in January 2011 by the New York City Department of Education. That was about 14 months after a janitor allegedly caught them in a darkened classroom at James Madison High School with one of the women topless and the other on her knees, according to the New York Daily News.

According to CBS New York, the pair had gone out to dinner, then returned to school for a student musical performance. They left for the classroom at some point during the show, the New York Post said.

After the janitor reported the incident the two were reassigned and eventually terminated.

The teachers denied any wrongdoing, saying they had gone to the classroom because Brito, a diabetic, needed candy to stabilize low blood sugar, the Daily News said.

A lower court determined in 2012 that they should get another hearing.

They shouldn't have been fired, a five-judge panel of the Manhattan Appellate Division ruled, calling the penalty of termination "shockingly disproportionate," the Post said. They added that "engagement in what appeared to be consensual sexual conduct with an adult colleague is not in and of itself criminal or otherwise improper."

The teachers' behavior didn't involve minors, the judges noted.

"Indeed, lesser penalties have been imposed where a teacher had an ongoing relationship or engaged in inappropriate behavior with a student," they said.

While Brito and Mauro demonstrated a lapse of judgment, there was no evidence that the incident was more than a one-time mistake, they said.

The judges sent the case back to school officials to consider a lesser penalty.

The ruling stunned faculty and students at James Madison, the Post reported.

"[It] sets a poor example for other teachers. They may think they can do it, too," a teacher who asked not to be identified told the newspaper.

"A student could have walked in on them," sophomore Tiffany Kagan said. "Things like that shouldn't be done in the classroom. Couldn't they have waited until they got home?"

Education Department spokesman David Pena said officials were disappointed in the decision and are weighing their options, the Daily News said. It was unclear whether the department would appeal or what sanctions might be imposed.

"I can tell you one thing for sure: My clients will be happy to be back in the classroom doing a job they love," their lawyer, Michael Valentine, told the Daily News.

CBS New York filed this video report:

Do you think the judges made the right call? Please leave a comment below.