Updated

BLAUVELT, N.Y. (AP) — A 14-year-old boy pulled a pellet gun at a suburban New York middle school on Tuesday and pointed it at a teacher, then waved it at passing cars outside until a retired police officer wrestled it away, police said.

It was the second gun scare at the school in less than a year.

Orangetown Police Chief Kevin Nulty said the boy was taken into custody and no one was injured.

The boy was in an office with a teacher and another student at South Orangetown Middle School when he pulled the realistic-looking pellet gun from his backpack "with no prompting" at about 9 a.m., Nulty said. He wordlessly pointed it at the teacher, the chief said.

He said there was no information on a motive. He did not know why the boy was with a teacher.

Then the boy ran outside to an intersection and pointed the gun at motorists, possibly trying to commandeer a vehicle. One driver was a retired New York City police officer who disarmed the boy, Nulty said.

"He backed his car up, he got out of his car, he was able to subdue the student and take the handgun away from him," the chief said.

The name of the retired officer was not made public.

The boy was charged with menacing, weapon possession and four counts of attempted robbery, the chief said. The robbery charges allege attempted carjacking.

"We are under the belief he was attempting to get access to one of those cars," Nulty said.

The gun was loaded with soft pellets. Such guns usually don't hurt people if they're fired from a distance, the chief said, but they can be dangerous. Police said they did not yet know who owned the gun. A pellet gun does not require registration, but an owner must be 16 years old, he said.

The 880-student school went into lockdown until 11:30 a.m. The same school had a lockdown on June 9, when an irate parent barged in and held the district superintendent at gunpoint.

The superintendent, Ken Mitchell, eventually disarmed the man, Peter Cocker of Tappan. Cocker was convicted of kidnapping and sentenced to five years in prison.

The incident on Tuesday "did certainly bring back a very unpleasant memory," said Mitchell, who is still the superintendent and was in the middle school for Tuesday's scare.

He said security at the school has improved since last year's incident. On Tuesday, the principal summoned police by pressing a newly installed panic button, Mitchell said.

The school does not have metal detectors. A security guard is posted at the entrance but students' bags are not routinely searched.

Blauvelt is a bedroom community and hamlet in Orangetown about 20 miles north of New York City.