The revelation that the super-secret National Security Agency (NSA) has been vacuuming up so-called “metadata” from foreign and American communications has lots of us in a full-scale flail.

The libertarian right denounces it as an unacceptable abuse of government power. Sen. Rand Paul, Kentucky Republican, is inviting millions of Americans to join him in bringing a class-action suit before the Supreme Court to stop this now-not-so-covert program.

Even the left that normally, reflexively supports whatever President Obama does is up in arms. The original story broke in Britain’s virulently anti-American Guardian newspaper and its flames have been fanned by some of Mr. Paul’s most liberal colleagues, such as Sens. Bernard Sanders. Vermont independent, and Ron Wyden, Oregon Democrat.

Here’s the question that must be addressed: Is this effort to detect and counter patterns of behavior that may be associated with terrorists and their plots legitimate and necessary? All three branches of government have agreed that it is legal and required — provided Team Obama is not doing as it has done elsewhere — namely, abusing its powers for political purposes.

Unfortunately, supporters of this program are being buffeted by growing evidence that the Obama administration continues to blur — if not actually brazenly to cross — the lines between constitutionally appropriate and legal actions and those that are beyond the pale.

Notably, the Daily Caller uncovered the fact that Douglas Shulman, the man who as acting Internal Revenue Service commissioner presided over the IRS’ scandalous abuse of conservative, Tea Party and Jewish organizations seeking 501(c) tax-exempt status, visited the White House 157 times from September 2009 to January 2013. That’s more than any Cabinet officer and far more than his predecessor, who went to the White House only once in four years.

So much for Mr. Obama partisans’ insistence that there is no connection between the president and this outrageous misconduct. It strains credulity that neither he nor his subordinates were involved in, or at least being kept apprised of, the politicization of the tax-collection apparatus. While we probably won’t know for some time exactly who was responsible — let alone whether they will ever be held accountable, the evidence of such rot in the system inevitably justifies skepticism about other government activities susceptible to abuse.

This is particularly worrisome in light of the extent to which Team Obama has demonstrated, with expert guidance from the same information-technology companies cooperating with the NSA, technical superiority in using to maximum political advantage personal data that is public or commercially available. “The Victory Lab: The Secret Science of Winning Campaigns” describes how the Obama campaign (both its official and private-sector apparatuses) identified and “nudged” prospective voters with micro-targeting and data-profiling.

In the face of an administration that often refuses to use actual intelligence about our enemies’ intentions (as with alleged Fort Hood shooter Maj. Nidal Malik Hasan) lest they “offend” leftist and Islamist constituencies, the national security-minded are going to see a continuing need for broad data surveillance. This will necessitate continued safeguards and checks and balances, with better-informed congressional oversight from the intelligence committees and judicial review of the nature of and justification for future use of this capability.

Those committees are acutely aware of their responsibility not to impede our ability to ferret out enemy cells through delays or leaks. This is especially a concern since our foes have proven agile in adapting their covert operations when they learn, usually thanks to leakers, about our intelligence-collection sources and methods.

For all these reasons, we require a debate that goes beyond the unfolding one about the wisdom and constitutionality of NSA data-mining. We also need to address whether we now must focus our intelligence assets and energies squarely on those who are most responsible for the threat we face at the moment: adherents to the Islamic supremacist doctrine of Shariah and the jihad it impels.

Needless to say, this would require myriad changes in the way the U.S. government has been conducting what it euphemistically calls “countering violent extremism.” For starters, we need to jettison that misleading term. It’s the jihad, stupid. We need to undo forthwith the insane November 2011 decision by the then-homeland security adviser to the president and now CIA Director John O. Brennan to purge information in the files of the FBI, the military, the intelligence community and Homeland Security Department that connects the dots between Shariah, jihad and terrorism — and resume training rooted in that causal linkage.

It is seductive to think that our security can be assured cost-free. It can’t. In the event of another, even more horrific jihadist bloodletting in this country, civil liberties could be sacrificed in a way that will make what is afoot at the moment — as best we can tell — pale by comparison. Our challenge is to keep the latter from happening while minimizing the infringement on the privacy of the vast majority of Americans. It would help in this regard if we dispense with the political correctness that is making us vacuum up everyone’s communications lest we “offend” those who are the source of the real threat.

Frank J. Gaffney Jr. was an assistant secretary of defense under President Reagan. He is president of the Center for Security Policy (SecureFreedom.org), a columnist for The Washington Times and host of the syndicated program Secure Freedom Radio.