HUNTSVILLE, Ala. – School districts across the country are increasingly employing snooping software or special cyber investigators to track students’ social media activates in an attempt to crack down on bullying and illegal activities.

But the practice of tracking what students say online, off-campus is a legally gray area that can result lawsuits over student privacy rights, as well as expenses for special staff or student tracking software, CNN reports.

The Huntsville, Alabama school district, for example, hired a former FBI agent on a $157,000 annual salary in January to lead a team of three staffers who track what students post on Facebook, Twitter and Reddit and other sites, according to WHNT.

MORE NEWS: Know These Before Moving From Cyprus To The UK

So far, the team has uncovered threatening or inappropriate online comments that lead to the expulsion of 14 students.

After two students in the Los Angeles suburb of Glendale committed suicide in recent years, district officials there hired a tech firm at $40,500 per year to track what students post publicly online. Chris Frydrych, CEO of the firm Geo Listening, told CNN the software has already helped one student who posted on social media about ending his life.

“We were able to save a life,” Glendale superintendent Richard Sheehan said. “It’s just another avenue to open up a dialogue with parents about safety.”

David Jones, president of another tracking company – Safe Outlook Corporation – said he has several clients who pay between $4,000 and $9,000 per year for CompuGardian, which has some very in-depth snooping capabilities.

School officials can sort student social media comments by keywords that connotes cyberbullying, or drug use, and so much more.

“You can identify a student, and you can jump into their activity logs and see exactly what they’ve typed, exactly where they’ve gone, exactly what they’ve done, and it gives you some history that you can go back to that child and use some disciplinary action,” Jones told WHNT.

MORE NEWS: How to prepare for face-to-face classes

“You can bring the parent in and say, ‘Hey, look, this is what your child’s doing. You need to talk to them about it.’”

CNN highlighted a Florida law enacted last summer that gives school officials the authority to comb a student’s Facebook posts and emails if a parent or student notifies them about off-campus bullying, but Wayne Blanton, executive director of the Florida School Boards Association said the tracking issue can be “a gray area that could … lead to a lot of litigation.”

“I think (privacy is) the biggest issue you’re wrestling with when you start intercepting someone’s messages,” he said. “Should I intercept your messages based on certain words? You’re really getting into a gray area that could potentially lead to a lot of litigation.”

And different states and courts have different takes on the balance between maintaining school safety and student privacy rights.

“Cases in point: In September 2013 in Nevada, a federal appeals court backed school officials in the suspension of a high school student who allegedly threatened his classmates with violence on Myspace. But in Indiana in 2011, a court found that school officials had violated students’ free speech rights when two girls were suspended from extracurricular activities for posting pictures of themselves with phallic-shaped lollipops,” CNN reports.

“And, in March 2014, a Minnesota student was awarded a $70,000 settlement after her school district forced her to turn over passwords for her Facebook and email accounts, according to the American Civil Liberties Union of Minnesota. As part of the settlement, the school district has agreed to change its policies to better protect students’ rights.”