A California 13-year-old received detention recently after sharing his lunch with a hungry student.

“I just wanted to give mine to him because I wasn't really that hungry and it was just going to go in the garbage if I didn't eat it," Bradford told the outlet.

He received the detention slip below:

However, according to the outlet, the district bans students from sharing lunch in order to make sure that students with allergies are not exposed to threatening foods. Superintendent of Trinity Alps Unified School District Tom Barnett told the outlet that, “Of course if students are concerned about other students not having enough to eat we would definitely want to consider that, but because of safety and liability we cannot allow students to actually exchange meals.”

Barnett also told The Huffington Post that while he believes many students in the district disregard the policy, “when it comes to our attention, we should follow what our recommended policies are.” However, he said he could not speak to the specific incident involving Bradford for privacy reasons.

On Twitter, users have condemned the district for its policy –- which some said punished a child for his generosity. Others say the child should have followed the school's rules.

There are rules in school. You follow them or face consequences. Kyle Bradford knowingly broke the rule. #parentsfail #idiotparents — Donna (@BerriliciousOne) September 20, 2014

We allow these folks to continue to ruin OUR KIDS AND OUR SCHOOLS. http://t.co/nM9cYZ8yBN — Bob Newbold (@rivercitycowboy) September 19, 2014

Really??? This school is absurd.... http://t.co/G3vmGMQLSd — Wayne Boesiger (@waynebomusic) September 20, 2014

Over on The Stir, Michele Zipp noted that the detention punishment seemed excessive.

“Our little Robin Hood of the cafeteria doesn't deserve to be punished for being kind, for having a heart. That isn't what we should teach our kids,” she wrote.