“There is no evidence that he has a criminal record, had been arrested before or since this one incident,” he wrote. “There is no evidence that this one arrest or the publicity it generated has impaired his ability to teach or that he has lost the respect of his students.”

On Oct. 17, Mr. Esteban, 34, of Manhattan, was arrested while returning from a recess in a murder trial where he was serving as a juror. Mr. Esteban tripped a metal detector and a court officer found a cigarette box in Mr. Esteban’s pocket with the drugs inside it, officials said.

Mr. Esteban was charged with possession of a controlled substance in the seventh degree, a misdemeanor. The charges were dismissed six months later, and the record sealed, after Mr. Esteban agreed to stay out of trouble with the law and complete a one-day substance abuse education program.

But the city still sought to fire Mr. Esteban, who had been teaching social studies and Spanish at the Williamsburg High School for Architecture and Design in Brooklyn since 2007, according to his lawyer, Eugene G. Eisner.

In May, the arbitrator, Alan Berg, agreed that Mr. Esteban should be fired, citing his “reckless handling of dangerous drugs,” which opened the school system to ridicule and left it unsure about whether Mr. Esteban had “brought the same drugs into a school building.”