A teenager was arrested Thursday after he brought a gun to a Brooklyn high school, the city police department said.

The 17-year-old was charged with criminal possession of a weapon for bringing the firearm to New Utrecht High School in Bensonhurst, officials said.

Police said officers responded to the school around 10:17 a.m. when they were notified that a male student entered the building with a gun.

Barrow surrendered his weapon, according to the police department, and officers took him into custody.

A city education official said the department is investigating the incident.