A few weeks ago, terrorists laid siege to a mosque in the small town of Bir al-Abd that lies just off the east-west road spanning the northern Sinai Peninsula. They killed 305 people and wounded many others. The photos from the scene were macabre—the stuff of Baghdad or Karachi, not Egypt. Until the attack on the al-Rawdah Mosque on November 24, the deadliest terror incident in Egypt occurred in 1997, when a group called al-Gamaa al-Islamiyya killed 57 people—most of them Japanese and British tourists—at the Temple of Hatshepsut near Luxor. The recent bloodletting in the Sinai is believed to be the work of Wilayat Sina, the Sinai branch of the self-styled Islamic State, though no one has claimed responsibility.

How could such an attack have happened? The answer is straightforward: The perpetrators are adherents of a worldview that views violence as the principal means of purifying what they believe to be un-Islamic societies. It was not a coincidence that the attackers went after a mosque associated with Sufism—a mystical variant of traditional Islam that violent and nonviolent fundamentalists consider apostasy.

Yet when it comes to Egypt and its security problems, there is a tendency among some observers to make matters more complicated than they need be. As with terrorist attacks in the recent past, there was a strain of commentary about the Bir al-Abd massacre that laid blame for the bloodshed with President Abdel Fattah al-Sisi, specifically with his efforts to consolidate his power and establish stability in Egypt. The implicit solutions offered in these missives consistently misconstrue Egypt’s lack of democracy as the underlying reason for Wilayat Sina’s violence. This is odd, because from the perspective of extremism’s theoreticians, both democratic and authoritarian political systems are equally illegitimate for no reason other than they place human made laws above those handed down by God.

If democracy or democratic change were the remedy to the extremism of the Islamic State and other groups, then Tunisia—the oft-cited success of the Arab Spring—would not reportedly produce as many followers of Abu Bakr al-Baghdadi as it does. The same could be said about Belgium or France. The connection between authoritarianism and terrorism and conversely, democracy as an antidote to political violence, was never as straightforward as some wanted to believe after September 11. These ideas, which formed the bases for George W. Bush’s Freedom Agenda, nevertheless live on, leading observers to conclude that when the Islamic State spills blood in Egypt, it must be because of repression.

This is not an apology for Sisi. Hardly. The Egyptian leader came to power in a July 2013 coup d’état, promising prosperity, democracy, and stability. The Egyptians have enjoyed none and Sisi bears significant blame. Along every dimension, Egyptians were better off when former President Hosni Mubarak was in power. Sisi deserves some credit for implementing economic reforms that the International Monetary Fund demands, but he also wasted a lot of time and money on mega-projects—the Suez Canal bypass and the new capital, for example—that have done less to help Egyptians than to provide a superficial sense of progress under his rule.

Sisi almost immediately dispensed with the idea of democratic reforms, falling back on the discredited but all too commonly held idea among Egyptian elites that a more open and just society will have to wait because Egyptians are not ready for democracy. Whatever Sisi claimed about political reforms should have been dismissed from the start anyway. The coup was intended to restore fully and reinforce a political system that military officers founded in the 1950s, and from which their descendants in uniform now continue to benefit. As a result, Sisi and his comrades are committed only to ensuring that they remain the source of the regime’s power, authority, and prestige.

Sisi maintains a modicum of popular support, but it is repression that has marked his tenure thus far. There are tens of thousands in jail, and in the course of a single morning in August 2013, Egyptian forces killed at least 800 people. Yet the insurgency in the Sinai Peninsula did not start with either the coup or what has become known as the Rabaa massacre, though it has accelerated since then.

Still it remains entirely unclear what any of this has to do with the violence at Bir al-Abd in November. Repression is certainly a bad thing, and Egypt has too much of it. Yet if Wilayat Sina is responsible as most reporting suggests, the group was not radicalized because Sisi overthrew Mohammed Morsi and engaged in a widespread crackdown on the Muslim Brotherhood. Extremists need no such encouragement. The Wall Street Journal’s editorial board and other observers make the case that the Egyptian government has failed to provide opportunities for the residents of the Sinai. This is absolutely true, but is it really the reason why an Islamic State affiliate murdered 305 people in late November? The most one could say is that some alienated young people, primarily men, may find the ideological and theological call from extremist groups appealing. That does not explain the violence, however. Rather it merely accounts for a context in which violent organizations find people who are willing to spill blood.

As a corollary to the arguments about the government’s neglect of the Sinai and unwillingness to pursue democratic reforms, smart analysts have also assailed the Egyptian government for mass arrests, extrajudicial killings, and a scorched-earth policy aimed at pacifying the Sinai, claiming that it did not work in the 1990s when Egypt faced another terrorist threat and that it will not work now. As hard as it may be to acknowledge, these are largely inaccurate statements. The low-level insurgency that had buffeted Egypt beginning in the fall of 1992 came to an end in 1999. The tools Mubarak used were police dragnets, state-sanctioned murder, military trials for civilians, and propaganda to diminish the draw of extremist ideologies. It is true that you cannot defeat ideas with bullets, bombs, and jail cells (which are often incubators of extremism), but between 1999 and 2011 Egypt did not confront a major terrorist threat.

What worked in the 1990s may not work now, and Egypt’s security forces seem to be particularly incompetent, though not any more so than before Sisi came to power. It is hard to blame Egypt’s commanders for using tactics that worked in the past. All militaries tend to fight the last war until it becomes unsustainable and then, if they are well led, they switch strategies. That is what happened with the United States in Iraq, beginning in 2006. That said, as Egyptian officers survey what the United States has done in the fight against the Islamic State, they no doubt understand that Americans have placed a premium on violence. As President Donald Trump promised during his run for the White House, the U.S. military has “bombed the [expletive] out” of Abu Bakr al-Baghdadi’s forces.

Abdel Fattah al-Sisi is not a wise man or a particularly effective leader. Egypt has layers of complex problems that he seems particularly ill-equipped to manage. He is also not to blame for the carnage at al-Rawdah Mosque.