I don't know the situation in detail. All we are given is a few sentences--I don't know what the culture of that community is like--whether violence is rampant or not. 27 years in prison for attempted murder makes not a whit of sense for a 16 year old. A prison sentence of some sort does make sense in addition to psychiatric treatment.
I had my own experience with bullying. After more than a year of being harassed by a group of junior high boys, I punched one of them in the hallway. He had challenged me to a fight after school. I said, "no, here, now." The fight was witnessed by fifty or more kids. It was more or less a draw, but I never had a another fight after that. I was not harassed for being gay, but for being unwilling to fight.