The thing is, the law can examine the circumstances and not just the crime. That's the point of a jury of peers and, ultimately, a judge.
The law can, but too often it misses the mark. As in this case. We have these laws in place to protect children from sex offenders and predators. This young man obviously fails to meet that criteria. The problem is that this isn't an isolated incident - The New York TImes wrote an article about this in 2010, but nothing seems to have changed.