Philip Mudd served as deputy director of the CIA’s Counterterrorist Center from 2003 to 2005 and as senior intelligence adviser to the FBI from 2009 to 2010. He is senior global adviser at Oxford Analytica, a global analysis and consulting firm.

President Obama backed down from his threat to veto the 2012 defense authorization bill that Congress passed this month. But the legislation takes a position on detainees that is misguided. It should prompt the president to fully exercise the discretion the legislation gives him.

For the first few years after the Sept. 11, 2001, attacks, it was not at all clear we were beating al-Qaeda: Terror attacks took place in London, North Africa, the Middle East, South Asia and the Philippines.

Today, al-Qaeda’s leadership is decimated and its regional affiliates are struggling mightily. The lone-wolf threat remains significant, but lone wolves do not represent strategic threats any more than gang killings represent the crippling of U.S. society. We have far to go to defeat our jihadist adversary and its slowly eroding ideology, but we are more than halfway through writing the book of the downfall and death of al-Qaeda.

Amid the global decline of deaths from terror attacks, our nation recently debated whether to give this group what it wants: continued treatment as a viable military adversary on par with U.S. soldiers. Doing so suggests that al-Qaeda fighters deserve to be treated differently than the common criminals and murderers they are. Their ideology is dying because they can’t defend themselves against charges of wanton murder across the Muslim world; that is their Achilles’ heel. Yet now we have agreed to mandate military custody for some detainees.

Rather than engage in a dispassionate assessment of what plagues our adversary, many in Washington focused on internal political disputes. Meanwhile, it’s the degradation of its platform that al-Qaeda hates, the perception that its fighters are weak killers with no vision and no future. Certain provisions in the defense legislation offer a boon to al-Qaeda, allowing its fighters to argue that they remain a strategic threat, that they are a powerful movement meriting a military response and that the growing perception that they’ve become common criminals is wrongheaded. We don’t seem to be fighting them when we decide they have to head to military custody; it’s what they want. We’re fighting among ourselves, even as we’re grinding them down operationally.

One rationale for why we are headed down this path might be that it is a better option for the U.S. agencies that have to interrogate the fighters. Yet not once in nearly 10 years in senior positions at the CIA and the FBI did I hear a professional raise this issue. Indeed, some of our most respected national security leaders have said they don’t need or want this law. Like the debate about whether we should direct law enforcement professionals to Mirandize suspects, this is a national security dispute in which questions about how to fight the enemy outside the Beltway have become subordinate to fighting inside the Beltway.

The legislation Congress sent the president grants him authority to waive the military-detention provisions. He should use it, as we recognize that the criminal justice system has tools the military doesn’t. A new, healthy debate could center on whether there should be adjustments to terror cases without mandating military custody. One useful legal action would be accelerating the deportation of non-citizens in national security investigations. We spend too many taxpayer dollars on people we should have simply expelled, but the process to send them home is cumbersome. As it considers best tactics going forward, Washington also should tackle the politically sensitive question of how to advance the legal process by which the United States collects digital intelligence. We’re mired in a decades-old analog process that was designed to accommodate Cold War needs. And it would be useful to address why, years after intelligence reform, we still lack a single clearinghouse for security clearances.

Our goal should be simple: Take what our adversaries hate and turn it against them. In countless statements, al-Qaeda and its affiliates have told us they cannot defend the killing of innocents. Military engagements are easy for them to explain; murder is not. In numerous polls across the Islamic world, citizens consistently say that they do not understand al-Qaeda killings of Muslims, though they have no problem with al-Qaeda and Taliban military engagements with the United States. And al-Qaeda’s footprint — its recruiting, its ability to take advantage of the Arab Spring and its presence on al-Jazeera — is disappearing because of its inability to answer these criticisms.

The United States does not want to suggest that al-Qaeda is a battlefield adversary; it is not. Yet we have said its members are worthy of treatment as military adversaries, requiring military custody. They are below this and slipping further every day from self-inflicted missteps. We should take advantage of their mistakes and use those errors against this fading threat. Don’t give them what they want. Give them what they hate.

The writer served as deputy director of the CIA’s Counterterrorism Center from 2003 to 2005 and as senior intelligence adviser to the FBI from 2009 to 2010. He is senior global adviser at Oxford Analytica, a global analysis and consulting firm.