John Hamre, a former deputy secretary of defense and chairman of the Defense Policy Board, is president and chief executive of the Center for Strategic and International Studies.

The tragedy of the Navy Yard shootings has gripped Washington. Many dimensions of this episode call for deep assessment: How could a clearly troubled man bring a weapon into a highly secure venue only to gun down government workers? How can we prevent such incidents in the future?

Much has been made of the fact that Aaron Alexis had a security clearance. That was not the cause of this incident, but it probably contributed by creating complacency in security officers at the Navy Yard. I have been critical of our nation’s security clearance procedures, but I hope Congress moves thoughtfully — and not in haste to score political points — to address this issue. Mistakes are invariably made when we legislate in fear and anger.

The murders by Alexis and the betrayal by National Security Agency leaker Edward Snowden both underscore a problem with our security clearance process. Fundamentally, the United States has a “perimeter security” system: A government adjudicator guards the gate, deciding who should be allowed through. But once clearance is granted, there is little further substantive assessment of an individual’s behavior or activities.

Clearances are supposed to be updated every five years, but that is not always observed. The process, which grew out of the bitter experiences with spies early in the Cold War, is obsolete. For example, applicants are still asked to identify every home they have lived in, and U.S. workers try to interview neighbors in each place. There is no differentiation between new college graduates and government workers who have held clearances for decades. Recently, a colleague who is a former deputy secretary of a major Cabinet department submitted his SF-86, as the clearance form is known. It ran 256 pages. He has been cleared nine times yet still has to fill out the same form everyone else submits.

Once you hold a clearance, however, it is generally carried over if you change jobs. Snowden’s peripatetic career is typical. Snowden should have been under intense, ongoing surveillance, not because of his personal behavior but because of the sensitivity of his position. His job was to move massive files to different computer networks in the NSA system. I can’t imagine a more sensitive job these days. Steady surveillance ought to be a condition of employment in such a position. I continue to hold special clearances, some of extraordinary sensitivity. The government should monitor me steadily because of the sensitivity of these programs, and I should expect such surveillance as a condition of my government work.

To a certain degree, our country pretends to do this. For every international trip I take, I must register my plans with an organization that holds my clearances. My last visit involved a private meeting with the prime minister of a major U.S. ally. I was asked to validate whether I met with any foreigners who spoke English or requested to stay in touch with me on an ongoing basis. These one-size-fits-all questions consume clerical time and do not meaningfully contribute to security. And what spy would answer truthfully anyway? Spies are not as dumb as our security process.

Too much time is wasted on procedures that produce too little security. There are spies in our midst. So why does our nation rely on a process that rests on someone reporting his own activities into a paper-bound system that is choking on process and produces no insight?

The case of Alexis is more complicated. He did not hold a particularly sensitive job or a highly privileged clearance. Our system is designed to defeat spies, not crazy people with homicidal impulses.

But there are potential solutions. Innovative organizations in the U.S. government are pioneering continuous surveillance methods that could have detected Alexis by using many data sources and reporting risky behavior to security supervisors. There were ample signs of a troubled mind, which should have triggered more rigorous supervision and monitoring. This type of oversight must be carried out through automated techniques. Our paper-based human review process would be overwhelmed quickly. When data suggest a more focused investigation is needed, trained investigators should take over. Privacy concerns must be addressed, but they could be managed in a manner acceptable to our society. Government employees and contractors understand that they must be held to higher standards and closer scrutiny precisely because they carry the credential of trustworthiness to deal with America’s secrets.

We mourn the needless death of civil servants. But we should learn and implement lessons that will really solve the clearance problem, not gratify a political impulse to act upon our national anger and shame.