A security guard spotted a man on the roof of a Medford elementary school early Thursday evening as about 30 children attended an after-school program inside, Suffolk police said.

The children at the Tremont Elementary School were moved to a secure area as officers and a K-9 unit searched for the man, police said.

But a review of video footage showed he had not gone inside the school but ran away outside, police said.

The incident started about 5:30 p.m. when police received a 911 call about a suspicious male on the roof. The security guard tried to talk to the man and went to a door to confront him, police said, but lost sight of him.

advertisement | advertise on newsday

Officers stayed with the children in the secure area and the students were not alarmed by the activity, police said.

The suspect, who wore a gray, hooded sweatshirt, was not found, police said, but the investigation continued into the night.