The justice dept caught a bunch of mafiosos without violating the rights of everyone else. Why? Because judges oversaw the handing out of search and wire-tapping warrants. A balance was found between security and liberty.
Unfortunately, what is happening now is that we are lead to believe it is one or the other. And it's made worse when the debate gets trapped in the "right vs left", "conservative vs liberal" context.
Seems to me that the judicial system needs to get more involved in this. Congressional oversight of NSA, TSA, DOD, etc has not really worked.
There is also a role for technology to play. Out of millions of calls, billions of emails, how do you flag that one bad guy? The implicit assumption in such a problem is that you collect the data on everyone so that you can look for patterns of bad guy behavior. But is there another way?