The gun found in a teen’s backpack just hours after he threatened to shoot up Benjamin N. Cardozo High School was legally purchased in South Carolina as the NYPD stepped up safety measures around the Queens school, Police Commissioner Jessica Tisch said Friday.

Metal detectors were put in place Friday at the high school — the day after the 16-year-old student was busted after allegedly threatening on social media to shoot up the school.

The teen, who has not been name, is facing charges of gun possession and making terroristic threats. A court appearance is pending.

The Bureau of Alcohol, Tobacco, Firearms and Explosives is investigating how the gun wound up in the hands of the suspect, Tisch said.

Tisch said metal detectors will be used at the Bayside school “for the foreseeabl

See Full Page