In an effort to prevent the next Fort Hood-style shooting before it happens, the Pentagon has launched a program to scan massive amounts of communications and detect anomalies in behavior that could predict "insider threats" to the military.

While the Pentagon's advanced research arm describes the project as being designed to detect threats to the military from within its own ranks, critics say such a system would inevitably invade the privacy of millions of people and could be the thin end of the wedge towards a "police state."

Earlier this month, the Defense Advanced Research Projects Agency posted a notice announcing the project. The agency has set aside $35 million for the effort, which has been dubbed ADAMS, or "Anomaly Detection at Multiple Scales."

If successful, the project would "detect ‘anomalies’ in a person’s behavior by sifting through billions of e-mail and text messages prior to such a homicidal or suicidal outburst," reports Government Security News.

"The focus is on malevolent insiders that started out as 'good guys.' The specific goal of ADAMS is to detect anomalous behaviors before or shortly after they turn," the agency states.

But DARPA's description (PDF) of the project doesn't address the issue of how a system to scan all communications within a certain area would square with constitutional rights and privacy laws.

As DARPA itself notes, a military base like Fort Hood, with 65,000 people on site, would be linked to some 4.7 billion instances of electronic communication among 14.9 million people ever year -- a very wide net to cast in search of potential crime.

"This is what a police state does -- everyone watching what everyone does and the police watching your every move," security technology writer Bruce Schneier told CNN. "And what we learn from history is that police states never work. It never is safer."

James Lewis of the Center for Strategic and International Studies told CNN that some companies are already involved in data mining at the scale of what DARPA is suggesting, such as credit card companies.

"But credit card companies can screen your transactions because you've entered into a contract with them and because it is in your interest to keep your account safe. The same isn't necessarily true for e-mail," Lewis said.

"If you are sending e-mail from your work account, your company has the right to screen it. But if you are sending it from your personal account, no one has the right to screen it unless they get a court order, and getting the court order requires some sort of advance knowledge of malicious intent, which defeats the purpose of screening."

For all the legal uncertainties, the Pentagon is casting the project as a way of saving lives.

"Each time we see an incident like a soldier in good mental health becoming homicidal or suicidal or an innocent insider becoming malicious we wonder why we didn’t see it coming. When we look through the evidence after the fact, we often find a trail – sometimes even an 'obvious' one. The question is can we pick up the trail before the fact giving us time to intervene and prevent an incident?"

So far, 23 companies have expressed interest in being contractors for the project.