A 17-year-old student at Cape Elizabeth High School was charged with misdemeanor terrorizing after he posted a message on social media that was interpreted as a threat involving a gun, Cape Elizabeth Police Chief Neil Williams said Monday.

The teen, whose name will not be released because he is a juvenile and is facing a misdemeanor charge, was taken into custody at a home on Minott Street in South Portland where he had been staying, Williams said.

Williams declined to release the text of the threat.

“It was general in nature but it was such that you could construe it to think firearms,” Williams said. “It’s very difficult to describe it.”

He said the teenager, who was still in police custody as of 9:30 a.m., was being cooperative. He is expected to be released to the custody of a parent or guardian. Williams said there is no indication the teenager owns guns.

No one else that police know of is connected to the alleged threat, Williams said.

The investigation began Sunday evening after the Cape Elizabeth High School principal was tipped off by other students about the posting. By 6 a.m., the SWAT team had converged on the home where the teenager was staying.

In an email to parents, school officials said the schools would be closed “out of an abundance of caution” after “an issue” was brought to their attention.

This story will be updated.