MADISON, Wis. — A 13-year-old boy who had researched school shootings online was arrested hours after he tried to enter a Wisconsin elementary school with suspicious bags, police said.

Investigators believe the boy was armed, judging by videos of him brandishing what investigators believe was a rifle and comments he made to other students, said Patrick Patton, police chief in Kenosha, a city on Lake Michigan between Milwaukee and Chicago.

The teen tried to enter Roosevelt Elementary School about 9 a.m. Thursday with a backpack and a duffle bag, according to police. Staff members grew suspicious and moved to question him, but he fled.

Kenosha Unified schools were placed on lockdown for the rest of the day as police searched for the boy. They arrested him at his home that afternoon.

The teen attends Mahone Middle School in Kenosha and was a former Roosevelt Elementary student, police said, but they have not released his name. They said in a news release Friday that he has been charged with making terroristic threats. Kenosha County District Attorney Michael Graveley said in an email to The Associated Press on Friday that the boy will be prosecuted in juvenile court, where proceedings are confidential.

It was unclear Friday whether the boy was actually armed when he tried to enter the elementary school. Patton said investigators believe he was carrying a firearm, but the chief has not said whether police recovered any weapons or ammunition from him.

A search of his home netted several pellet guns that resembled real handguns and a pellet rifle that resembled a real rifle, police said in Friday’s news release. The boy’s mother told investigators he didn’t have access to any actual firearms.

The teen told detectives he went to the elementary school to sell candy but later told a social worker he intended to scare students, police said.

Investigators also “have information that the suspect performed multiple internet searches related to school shootings,” Patton said Thursday, adding that the teen had shared videos and made several comments to fellow students for weeks before Thursday.