A New York City court ruled that a teacher cannot be fired even after he told a student she can "striptease" for him and be his "sex slave," the New York Daily News has learned.

Steven Ostrin of Brooklyn Technical High School - the same school where another teacher was charged for having sex with several female students - has shown a propensity for "inappropriate, predatory and unrepentant behavior" since the early '90s, according to the Department of Education.

But according to the appellate court ruling released this week, the DOE can't terminate the 61-year-old's employment based on his remarks.

Ostrin, of Long Island, has been investigated for a series of alleged inappropriate actions over the past two decades. A 15-year-old female sophomore claimed in 2005 he not only told her she could "striptease" for him, but also gave her a kiss and suggested she could be his "little sex slave," the Daily News reported.

The teacher also told her not to wear "skimpy clothes" because he might become aroused, according to the student identified only as G.O.

Officials investigated the girl's claims and banned Ostrin from the school's classrooms, but no charges were filed because the teenager's credibility was thrown into question, the newspaper reported.

Meanwhile, the alleged perv continued to collect his salary. When his case made it to a hearing, the presiding officer determined his "sexual banter" did not indicate he was trying to have sex with the 15-year-old. He was suspended for six months.

The DOE brought the case to a higher court, but the court sided with the hearing officer in 2012, according to the Daily News.

City officials tried one more time to get rid of Ostrin with the Appellate Division court. Its decision to uphold the lower court's ruling was unanimous.

Ostrin, who has since retired, told the newspaper he has taken full responsibility for what happened and doesn't understand why the DOE has continued its "asinine" case against him after all these years.

"The courts ruled in my favor...Courts keep saying, 'Why do you keep trying to go after a person who is retired?'" Ostrin said.

The city's Law Department is looking into any possible next step.