The success of the U.S. special operations forces raid, which killed Islamic State leader Abu Bakr al-Baghdadi, was a great moment for the United States and our ongoing fight against terrorists who would do us harm. Less so the spectacle that unfolded in the hours after the news broke, when President Donald Trump politicized the raid’s aftermath and jeopardized our foreign policy and military operations in the process.

Let’s begin with stating what should be obvious but bears further emphasis: This is a really big deal. Some commentators have been quick to note that with this death, ISIS is still not defeated and al-Baghdadi will inevitably be replaced by another leader, but that line of argument misses the importance of particular leaders in shaping terrorist groups, and of al-Baghdadi specifically.

Al-Baghdadi’s genius as a terrorist leader was to move his group away from the secretive membership-based al-Qaeda network to a Salafi jihadist movement. Whereas al-Qaeda chief Ayman al-Zawahiri generally counseled against holding territory, al-Baghdadi established a quasi-state in Iraq and Syria and attracted tens of thousands of foreign fighters to the so-called “Caliphate.” He pulled oil and other resources out of this region to finance his operations. He quickly accepted new “provinces” in Libya, Nigeria, Yemen, Afghanistan and elsewhere, foregoing the often years-long vetting process of new affiliates that al-Qaeda employed. He also made the strategic decision to promote a rapid pace of lone wolf attacks, betting that a steady drumbeat of violence would impact the West more than the sporadic, but often disrupted, major terror attacks that al-Qaeda favored. To support these frequent acts of violence, he built an online juggernaut that operated seamlessly across social media, the dark web and encrypted applications to both recruit followers and enable their violent acts. He was an innovator in the most sinister of ways, and his death makes the United States, our allies and the people of Iraq and Syria safer.

The act of removing him, too, was nothing short of amazing. Al-Baghdadi had been our country’s top terrorist target for years. He often seemed to be a ghost, seen in photos or on video only a handful of times and reported to travel in disguise to avoid detection. As I predicted in early 2017, it was dogged intelligence work, and cooperation with our regional partners that ultimately allowed the U.S. government to pinpoint his location. And then it was up to our special operations forces, who have perfected operations in this dangerous region over the past several years, to finish the job. They performed masterfully, the combination of experience, planning, and training leading to an operation in which U.S. forces suffered only minor injuries. It was a testament to the incredible professionalism of our entire counterterrorism community and the culmination of nearly two decades of building competence around a critical mission.

As for Trump, he too deserves a good deal of credit. To be sure, he also deserves criticism for his recent hasty decision to withdraw from Syria. But on this mission, the president was presented with what must have been only risky operations, involving flying U.S. forces all the way across Syria, to conduct an operation in a region thick with al-Qaeda fighters. In that moment, the fate of our troops rested in the president’s hands, and he made a gutsy call. It paid off.

Had it ended there, the whole hunt for al-Baghdadi would have been both a huge win for the United States and an accomplishment for which Trump could rightly take credit, much as President Barack Obama did after U.S. forces killed Osama bin Laden in 2011. Yet by midday Sunday, Trump had given into his partisan instincts – with a bombastic press conference, in which he revealed that congressional Democrats had not been given advance notice of the operation, only Republican leaders, turning what should have been a unifying moment into just more divisiveness stoked by Trump.

In a normal administration, the operators’ heroism would have been complemented by the execution of a tight and professional playbook in Washington. During my time in the Obama Pentagon and National Security Council, I supported dozens of sensitive special operations. While the operators were preparing for their mission, and even while they were still conducting it, we were preparing for the aftermath. We would assiduously draft press statements and responses to expected queries about the operation, preparing for both successful outcomes and tragedy. We worked closely with the president’s speechwriters to make sure he accurately described the operation and avoided disclosing sensitive information. We drafted language for diplomatic cables so that our ambassadors could inform our partners. And we would build out detailed talking points and plans for notifying members of Congress, ensuring that both majority and minority chairs of the appropriate committees were notified of the operation, never contemplating the exclusion of Republican lawmakers.

Protecting the secrecy of the mission and the lives of our forces was always paramount. But after the mission, it was our duty to make sure that the public could understand the operation and its outcome, that our partners received critical details on operations happening in their neighborhood, and that congressional committees were given the details they needed to exercise their oversight responsibilities. If we got some of the details wrong – as happened, for example, in the early days after the bin Laden raid – we paused to get everybody on the same page and then proceeded once our facts were straight.

Compare that with how Trump handled communicating al-Baghdadi’s death to the public and Congress. There were signs that the National Security Council and the counterterrorism community planned for the aftermath of the operation, and a facsimile of the Washington playbook appeared. Congressional leaders were notified, but the administration only engaged Republicans, spurning House Speaker Nancy Pelosi and the Democratic committee chairs and ranking members who help oversee the intelligence community and armed services. Defense Secretary Mark Esper stuck to careful talking points about the mission, but Trump embraced his instincts, regaling reporters and his supporters with extensive details of the operation, while reveling in the gory details of al-Baghdadi’s death. Some questioned whether he could have even known the details of Baghdadi’s final moments based on the information provided to him in the White House Situation Room. Others, including the former White House photographer who took the iconic photo of Obama and his team watching the bin Laden raid, questioned whether the photo of Trump and his team was actually contemporaneous or staged after the operation had concluded. Trump even appeared to suggest that killing al-Baghdadi was more significant than bin Laden’s death, a game of one-upmanship inappropriate for discussions of targeted killing.

By Sunday afternoon, stories appeared in which intelligence and special operations professionals criticized the extraordinary level of operational detail revealed by Trump. They argued it would compromise sensitive tactics and tip the enemy’s hand on future raids. Retired Ambassador Dana Shell Smith lamented on Just Security the harmful language Trump used to describe al-Baghdadi, saying he was “whimpering and crying and screaming” and comparing him to a dog. For Smith, who has served in several Middle Eastern countries, this kind of rhetoric can inspire anti-U.S. sentiment even among those who have no love for al-Baghdadi.

For all the importance of keeping counterterrorism apolitical, high profile operations like these do have political upside for the president. Obama got a big political boost from ordering the mission that killed bin Laden, and rightfully so. It was a gutsy call, and in taking the risk to green light it, Obama delivered perhaps his strongest rebuttal to those who harbored doubts about his ability to lead on national security. He handled the planning process and ordered the mission with the utmost deference to the professionals in his government, and he spoke about it in a way that both dignified the bravery of our people and soberly handled the serious business of targeted killing. In that sense, the political bounce he got in many ways reflected the competence he displayed on an important issue.

It could have been the same for Trump: a good news story about his leadership of the national security apparatus and a validation of the people and processes he has put in place. Instead, Trump made yesterday a spectacle he used to promote himself, offend foreign populations, undermine congressional oversight, and compromise the sensitive tactics our operators use to execute their critical missions.

The Navy SEALs have a slogan that is widely quoted in the counterterrorism community: The deed is all, not the glory. But for Trump, it’s only about the glory. Our ability to accomplish the deed will suffer as a consequence.

Photo by JIM WATSON/AFP via Getty Images