New York City’s efforts to fire what it calls the “heroin teacher” received a setback this week that has Mayor Michael Bloomberg fuming.

An arbitrator earlier this year ruled that a Brooklyn high school teacher should be fired after he was arrested for bringing heroin into a courthouse while on jury duty. But a State Supreme Court judge overturned the decision, calling the firing “unduly harsh” and “shocking to this court’s sense of fairness.”

Needless to say, Mr. Bloomberg was not amused.

“We could not disagree more strongly with the judge’s decision to overturn an arbitrator’s ruling terminating a teacher for possessing 20 bags of heroin,” the mayor said in a statement this afternoon.

“The judge ruled that the termination ‘shocks the conscience,’ which shows a callous indifference to the well-being of our students,” he added. “That truly shocks the conscience and boggles the mind.”

City lawyer Michael Cardozo piled on: “We cannot fathom how a teacher who took 20 bags of heroin into a courthouse is fit to stand in front of a classroom and teach the City’s schoolchildren.”

The teacher, Damian Esteban, was arrested while serving jury duty last year when cops discovered 20 glassine envelopes of heroin hidden in a bulging pack of cigarettes, according to the city’s Law Department. Mr. Esteban claimed he was unaware the drugs were in his backpack and, according to the city, the charges were dismissed after he agreed to attend a treatment program.

Mr. Bloomberg vowed to appeal Mr. Mendez’s decision, sending the case to an appellate court.