BROOKHAVEN, N.Y. – Sometimes the court system doesn’t make any sense at all.

A former high school social studies teacher was somehow acquitted of six felony charges for having sex with an underage student, but was convicted of a misdemeanor involving the same offenses and sentenced to six months in jail.

The relationship between former Bellport High School teacher Jonathon Elsalam and the student began when the girl was 16, according to Newsday.com.

MORE NEWS: Know These Before Moving From Cyprus To The UK

The victim spoke at his sentencing Thursday and angrily accused Elsalam of “betrayal, manipulation and deceit.” She admitted pursuing the teacher in a romantic manner, but says he took advantage of the situation and her vulnerability.

Incredibly, defense attorney David Besso said he didn’t think any jail time was warranted at all. He accused the student of “stalking” the teacher and said his only offense was his failure to resist.

“There is a temptation, no question about it,” Besso said.

Of course there are natural temptations for high school teachers. But they are the adults in the situation, which means they are expected to possess the maturity and self-control to check their impulses and conduct themselves professionally.

It’s absolutely crucial that they do so, because they are dealing with a bunch of children walking around in adult bodies. These kids depend on their teachers for support and guidance during a challenging period of life. They are betrayed when teachers take advantage of their vulnerability for cheap sexual gratification, and the punishment for such betrayal should always be severe.

We have no idea how Elsalam managed to slip out of the felony charges. But he was very lucky to only get six months of jail time. A lot of teachers around the nation have gone to prison for long periods for the same type of offense.