Huntsville schools Superintendent Casey Wardynski said the schools began a monitoring program after receiving a call from the NSA

A secret surveillance program has been running in an Alabama high schools after a phone call from the National Security Agency alerted the district to a 'violent threat'.

School officials claim the system began monitoring students' social media accounts in Huntsville City Schools 18 months ago, when the NSA tipped them off that a student was making violent threats on Facebook

The schools began scanning Facebook and other sites for signs of gang activity, watching for photos of guns, photos of gang signs and threats of violence, as part of a program called SAFe, or Students Against Fear.

Internal documents explaining the program were obtained by AL.com, showing four different students - three males and one female - posing on Facebook with handguns.

None are on school grounds. Some of the students were already in alternative programs for skipping or drinking. Three are listed as expelled and one was referred for counseling.

Huntsville schools Superintendent Casey Wardynski told the news site that there was a 'foreign connection', which was why the NSA - a U.S. agency responsible for foreign intelligence - became involved.

He said the student in Huntsville had made the threats while chatting online with a group that included an individual in Yemen.

Mr Wardynski, a former U.S. Army colonel appointed as superintendent in Huntsville in 2011, said that about a year and a half ago the NSA called Huntsville and reported a high school student had made a threat on Facebook to injure a teacher.

Al Lankford, the city's school security officer, told AL.com that he took the NSA phone call and that security officers went to the high school and eventually searched the boy's car.

'We found a very good size knife and the student was expelled,' Mr Wardynski said.

But this week the NSA said it has no record of a call to Huntsville and insisted it does not make calls of this type.

Vanee Vines, public affairs specialist with the NSA, said: 'The National Security Agency has no record that it passed any information to the Huntsville school district, and the description of what supposedly occurred is inconsistent with NSA's practices.'

She said any information about a domestic safety issue would be sent to another federal agency, like the FBI. 'Moreover, NSA does not make recommendations regarding school safety programs,' Ms Vines added.

The schools began scanning Facebook and other sites for signs of gang activity, photos of guns, photos of gang signs and threats of violence, as part of a program called SAFe, or Students Against Fear (stock image)

Mr Wardynski said the monitoring program has been used to break up a gang called the Wolfpack, which consists of six or seven members related through family and spans across several schools. The students were expelled and placed in alternative school and boot camp programs.

'People are very good about 'If you see something, say something,' he said.

The monitoring program is designed to be limited to threats against schools, and students can be expelled from neighborhood schools and placed into alternative programs.

When AL.com asked if school officials are also searching online for photos of alcohol, drugs and sex, Mr Wardynski replied: 'None of that.'