A New Hampshire school was locked down after a 21-year-old former student was seen with a gun in his waistband on the campus, police told the Associated Press.

But as of 9:45 a.m., a suspect was taken into custody, CBS in Boston reported.

The police said West High School has been locked down as a precautionary measure, and all the students are safe.

Police are searching for the former student, but no other information is available at this time.

Numerous police cars have surrounded the school in New Hampshire's largest city, which is about 20 miles south of Concord, the AP reported. It has about 1,300 students.

Precautionary lockdowns are not uncommon, and some can even be from pranks.

In Ossining, New York, on Wednesday, the high school was put on lockdown as a precaution to an unknown potential threat to the school, PIX11 reported.

In a letter to parents, the school wrote, "Last night we were made aware that several Ossining High School students wrote inappropriate comments on a popular social media platform that could be interpreted as a threat to Ossining High School."

Also on Wednesday, in New Mexico, a handgun accidentally went off in a middle school, causing panic, The San Antonio Express-News reported.

The school was placed on lockdown after a 12-year-old boy brought the weapon to Harris Middle School, and the weapon discharged in his backpack at about 10:30 a.m.

The school was reopened less than two hours later and nobody was injured.

The FBI reported in 2010 that "the list of school shootings continues to grow, and school administrators, law enforcement personnel, parents, and concerned citizens must consider all possibilities."

In addition, though there are guidelines on when and how to initiate a lockdown or shut-out, the FBI advises schools to consider their unique situation and take appropriate steps.