When Severus Snape assumed the position of Headmaster at Hogwarts, he enforced strict rules, reinstating some of the decrees previously introduced by Dolores Umbridge. Such measures, of course, did little to make him popular among students and teachers, especially given that he hired two Death Eaters, the Carrow siblings, who terrorized everyone and didn’t hesitate to use the Cruciatus Curse on offenders.
However, despite his apparent harshness, Snape genuinely sought to protect the students and did so on several occasions. One of the most striking examples of this, which didn’t make it into the film adaptation, was his decision regarding the punishment for Ginny Weasley, Neville Longbottom, and Luna Lovegood.
This trio of friends attempted to steal the Sword of Gryffindor from the Headmaster’s office but was caught in the act. Such a serious offense could have warranted severe punishment—possibly even at the hands of the cruel Carrows. But Snape, contrary to expectations, didn’t hand them over to the Death Eaters. Instead, he sent them to Hagrid for their 'punishment.'
It’s safe to assume that the students likely saw this punishment as more of a lighthearted excursion, and Snape undoubtedly knew this. By making this decision, he effectively saved Ginny, Neville, and Luna from a much harsher fate, demonstrating that even in the darkest circumstances, his primary goal was to protect the students of Hogwarts.