Darnell Hamilton, a 17-year-old Chicago teenager, brought a gun to school for what his mother claims was protection against gangs that harassed him. REUTERS

A Chicago teenager brought a gun to school in order to protect himself from gang members who have harassed him for years, according to the boy’s mother.

As the Chicago Tribune reports, Darnell D. Hamilton, 17, attends the Urban Prep Charter Academy on the West Side of the city. His mother says he encountered daily threats from gang members trying to recruit him as he made his way to school. “They wait for him when he gets off the train,” she said.

According to DNAinfo.com, Hamilton and his mother live in the Logan Square neighborhood in Chicago.

Hamilton finally got a gun from a friend and stored it in his locker on Tuesday, the Tribune noted. The firearm was seen by someone at school, and that person told the school’s principal, who alerted authorities.

Cops found a 9mm handgun in Hamilton’s locker and a magazine with eight live rounds of ammunition in his bag. The gun didn’t have a round in the chamber, the Tribune reported. Hamilton said he got the gun after gang members "stated they were going to kill him,” according to the police report. Hamilton doesn’t have a known gang affiliation.

Hamilton has been charged with unlawful use of a weapon and possession of a firearm in school, according to the Tribune. His bail was set at $75,000.

“I mean this is just sad,’’ Petty said. “I kept looking at the door and waiting for my son to come through and I was just saying prayers. I know he saw me and I looked at him. He’s probably a little embarrassed and he knows my expectations of him and standards are high.”

Hamilton’s mother said her son has a 4.0 grade point average and has been promised a scholarship to go to Ohio State University, though he’s also considering Duke or Howard University for computer engineering, according to the Tribune.

“He made a bad choice and he wanted to protect himself,” Petty said.

"The surrounding communities around our West Side campus has its issues and certainly our students may face challenges going to and from school," Evan Lewis, COO of Urban Prep Academies, said, according to DNFAinfo.com. "But those challenges are no different than other students attending urban schools. We provide security at all our campuses and one thing I can tell you is we had no issues with Mr. Hamilton at the school."

Hamilton’s mother said she hopes to post bail for her son on Wednesday night, according to the Tribune.

Gun violence continues to plague Chicago. As previously reported, multiple shootings in the span of a few hours last Thursday resulted in one dead and 17 injured. According to the Washington Post, Chicago tallied more homicides, 500, than any other U.S. city in 2012.