A juvenile was arrested Thursday night hours after he allegedly stabbed a teenager in the shoulder outside a Hempstead middle school, authorities said Friday morning.

Nassau police special investigations squad arrested him, Hempstead Village police said. Nassau police said information on the case was not immediately available early Friday.

The 14-year-old victim, who was not named, was in good condition after being taken to a hospital, according to village and school officials.

Hank Williams, principal of Alverta B. Gray Schultz Middle School, said the teenager was stabbed about 4 p.m. at a time when about 50 students were on campus for after-school activities.

advertisement | advertise on newsday

“When I got the call, I was so scared that it was one of my kids at the 3:30 program after school,” said Williams, who was in a district meeting at the time.

Neither youth attends the school, he said, but the suspected attacker did at one point attend the school.

The teenager was stabbed by a younger boy outside the school’s front gate on Peninsula Boulevard and may have tried to escape by running onto school grounds, the principal said.

The suspect took off, but school security and police said they knew who he was, Williams said Thursday night.

Williams said the attack may have been gang-related. He said he was shown a photo of the victim with a bandaged shoulder.