I think it is highly unlikely that any of his actions would result in any significant jail time. Community service, a fine, and/or some sort of probation are all more likely.
I had a childhood friend who got in with a bad crowd in high school. At some point, when he was about 17, he was caught illegally entering a business at night. His parents refused to go pick him up from the police station, so he had to spend the night and most of the next day in a cell. I don't believe his ultimate punishment involved any jail time.
I respect his parent's decision. That sort of action teaches a troublesome kid that there are real consequences for breaking laws beyond just upset parents. While a criminal record might make it harder for him to get a job in the future, it certainly doesn't make it impossible. I also suspect it is better than letting a kid think that other people will protect him and he can get away with whatever he wants.
I'm suggesting no such thing. I'm saying that if someone thinks that this person should be sheltered entirely from the consequences of his actions then it is similarly logical to shelter society from his cruelty. If you'll notice I haven't actually suggested a course of action for dealing with him, I've only suggested that he needs to experience consequences for his hateful and violent attacks.
How long do you think he should be kept away from society?
His actions don't justify a life sentence or the death penalty, so he's going to be part of society at some point.
Is taking him out of society going to make him a better person? No.
The best way to rehabilitate someone is for them to have something to lose.
If this 17yo had a wife/child of his own then it is far less likely that he would have done this harassment.