OAKLYN, N.J. — Three teenagers arrested Sunday with a cache of guns, knives and swords planned to target people they considered enemies, then carry out random attacks, police said.

The teens were taken into custody about 4 a.m. in Oaklyn, a Philadelphia suburb, after a driver reported a carjacking attempt.

"We could have had a disaster here in Oaklyn," Camden County Prosecutor Vincent Sarubbi said Sunday night.

Arrested were 18-year-old Matthew Lovett and two boys, ages 15 and 14, whose names were not released. They were charged with weapons offenses and attempted carjacking. An additional charge of attempted murder was being filed against the three Sunday night.

Lovett, who is accused of pointing a gun at the officer who arrested him, was also charged with aggravated assault, Sarubbi said.

Authorities seized two rifles, a shotgun, two handguns, two swords, several knives and 2,000 rounds of ammunition. Additional weapons were found at Lovett's home. Sarubbi said the weapons belonged to Lovett's father and were legal.

Sarubbi said the attacks had been planned over the course of several months. The suspects intended to target people at random once they had attacked specific victims.

Sarubbi said three people believed to be intended victims were notified Sunday of the plot. The prosecutor declined to identify them, but police indicated they were students.

Mathew Rich, who reported the carjacking attempt, said he was leaving for work when he saw the three, dressed in trench coats and standing in front of a school.

One crossed the street in front of him, opened his coat to reveal a handgun, then signaled for his friends.

Rich said he drove around them, then notified police.

When Rich returned to the area after driving to the police station, he saw the weapons being confiscated.

"These guys were ready for a war," Rich said.