The city’s bad-apple teachers have a surprising new ally these days — Manhattan judges.

The jurists are increasingly refusing kartal escort to side with city education bigs to punish rogue educators fired for drug- and sex-related offenses, according to a review of recent cases by The Post.

At the heart of the troubling trend is a legal standard that requires the courts to defer to the city’s Department of Education when it terminates a teacher — unless the judge believes that the firing “shocks the conscience” experts said.

Given the growing number of overturned punishments, it is clear that the “shock” threshold is “getting easier and easier to meet,’’ a court source noted.

Some legal observers insist that the judges aren’t to blame, arguing that it is really the fault of city education officials for leveling overly harsh punishments against bad teachers in the first place because they don’t want to be criticized in the press.

But disgusted education advocates aren’t buying it.

“To me, this just exemplifies the lack of common sense that permeates our legal system,” said James Copland, director of legal policy at the nonpartisan education think tank the Manhattan Institute.

“We worry about the quality of our classrooms, the quality of education we’re providing our children.

“But the legal system seems bent on protecting the rights of teachers to extraordinary degrees and leaves the students vulnerable.”

The controversial “conscience’’ standard has been around since the 1970s, when it was established by the state’s highest court.

The Court of Appeals wrote in Pell v. Board of Education that judges should typically defer to education officials because they are ultimately responsible for their 77,000 employees.

For decades, the ruling meant that judges rarely second-guessed DOE arbitrators’ disciplinary rulings. But experts, citing several overturned high-profile cases in recent years, say that way of thinking is rapidly changing.

For example, trial and appeals courts alike found it “shocking” that a Brooklyn high-school teacher was canned for bringing heroin to court in a backpack.

The courts also were “shocked’’ at the firing of two female romance-language teachers over a topless tryst in a classroom.

Last month, the city was forced to appeal a court ruling that sent a Queens elementary-school teacher back into the classroom even after she flunked three of her four previous performance ratings.

Veteran PS 2 teacher Lisa Broad had been fired in 2014 after “three different senior administrators found that Broad poorly planned and executed lessons, failed to implement key teaching strategies, confused students, and wasted lesson time,” city lawyer Ryan Mangum argued in the appeal.

Not only that, “the record is also replete with instances of Broad’s professional misconduct, which included her fabrication of grades, flouting of deadlines, and violations of school policy by bringing a knife to school, having physical contact with a student, and leaving school premises during the school day without telling anyone,” Mangum wrote.

Still, lower-court Judge Alice Schlesinger — the same Manhattan jurist who found it “excessively shocking and severe” that two Brooklyn teachers were canned for the topless classroom romp — said Broad should keep her job because she was a “beloved teacher who had 27 years of experience under her belt.”

Mangum wrote in his appeal that Schlesinger misread the law, arguing that it only gives her “extremely narrow” grounds for overturning the DOE’s decision to fire Broad.

“The disciplinary process is a crucial aspect of DOE’s operations, because it is the process by which DOE identifies poorly performing teachers, makes efforts to help them improve, and dismisses those who frustrate DOE’s operations or are beyond reasonable remediation,” Mangum wrote.

“This process becomes unworkable when courts freely second-guess an independent arbitrator’s findings regarding disciplinary decisions,” he said.

But the fight to fire the teacher may be an uphill battle.

The same Manhattan appeals court currently considering Broad’s case upheld Schlesinger’s 2012 ruling reinstating the infamous tryst teachers, Alini Brito and Cindy Mauro.

In 2009, a janitor caught Brito and Mauro half-undressed in a darkened classroom at Brooklyn’s James Madison HS while students performed in a talent show in the auditorium.

The Manhattan appeals panel reasoned in 2014 that the women should not have been fired because the sexual shenanigans occurred after hours and were not witnessed by any students.

Their lawyer, Michael Valentine, said the case has now been widely cited by other teachers in fighting their own ousters.

“The Appellate Division decision in our case really gave the New York County judges some flexibility. I believe the courts are starting to rule against the DOE on the imposition of penalties,” Valentine said.

He claimed that Schlesinger “may have prevailed upon the hearts of some of her colleagues to take a closer look at some of this instead of just blindly rubber-stamping the [DOE] decisions,” Valentine said.

“It’s good precedent,” he said.

Copland, the Manhattan Institute scholar, disagreed.

In addition to Valentine’s two clients, he said it was outrageous that the courts reinstated teachers such as Park Slope educator Terrell Williams — who pestered his students for dates with their relatives — and heroin-holding Williamsburg instructor Damian Esteban.

“It’s patently absurd that teachers who are soliciting dates from their students’ moms or having sex in classrooms or carrying around heroin can’t be fired from their jobs,” Copland said.

“But that’s what the courts are doing, and they’re overriding the common-sense decision-making of administrators who are trying to run the schools to help the students learn.”

As with the sex-romp teachers, Manhattan’s appellate court said Williams should not have been booted from the classroom.

Williams, an eighth-grade gym instructor at PS/MS 282, did “not violate any specific rule or regulation,” the panel found in September.

Five female students testified at a DOE hearing in 2013 that Williams approached them at a volleyball practice and asked “whether they had older sisters, how old [their siblings] were, what they looked like and whether he could have their phone numbers,” according to court papers.

The questioning made the students feel “uncomfortable,’’ and one mother filed a complaint when Williams texted her daughter, according to court papers.

But Williams’ ouster “shocked” the judges — while their ruling horrified parents at PS/MS 282.

“I don’t feel like he should be allowed to teach again,” dad Corey Settles told The Post when the decision was released in September.

With Esteban, the appeals judges ultimately found him unfit to teach, despite what a lower court ruled.

As a political matter, [the DOE] would rather see a judge slammed in the New York Post than the DOE slammed in the New York Post.

The higher court rejected the 2013 ruling by Manhattan Supreme Court Judge Manuel Mendez, who decided that termination was too harsh a penalty for having heroin.

The teacher lost his job at the Williamsburg HS for Architecture and Design after he was caught with the illegal drugs during a routine security check while he was serving on a jury in Manhattan Criminal Court in 2012.

The higher court reversed Mendez’s decision in 2015, saying that it was “not irrational or against public policy” to fire Esteban for “public possession for heroin.”

Benjamin Dictor, the lawyer who represented Esteban, said that while his client ultimately lost his bid to be reinstated, the courts’ recent trend to back embattled educators is just backlash against an overzealous DOE.

“To the extent there is such a trend, I think it may be a result of the disciplinary process within the Department of Education becoming more punitive,” Dictor said.

CUNY Professor David Bloomfield contends that the DOE would rather be harsh on teachers than be criticized by the press.

“As a political matter, [the DOE] would rather see a judge slammed in the New York Post than the DOE slammed in the New York Post,” Bloomfield said.

Bloomfield said judges also “are really reluctant to fire someone from their job and their career. It’s the individual before them, and not the children who may be effected by this.”

Still, he said, “great deference to administrative decisions is a judicial tradition that makes sense.”

The state Legislature, with the support of the teachers union, created the independent arbitration system to handle such disciplinary issues.

Those arbitrators hold full hearings on the allegations, as opposed to judges who are looking at a record.

Dictor said the department, taking its cue from the judges, might now finally be softening up on teachers.

He said he has cited pro-teacher rulings by Schlesinger and the Appellate Division to recently beat back departmental charges against his clients.

“We’ve had a couple of cases in the past year that we’ve gotten very favorable results from arbitrators on,” Dictor said.

Still, Bloomfield predicted that too many rulings favoring questionable teachers could cause the pendulum to swing the other way.

In its first set of decisions in 2017, Manhattan’s Appellate Division refused to toss out an arbitrator’s termination of a Bronx elementary-school teacher named Janet Levy-Napoli.

The PS 146 teacher refused to improve her skills after three years of unsatisfactory ratings.

Termination for her stubbornness “does not shock the court’s sense of fairness,” a five-judge panel wrote in a Jan. 3 ruling.

Our editors found this article on this site using Google and regenerated it for our readers.