Egyptians hold candles at a vigil in Cairo's downtown district. (Mohamed El-Shahed/AFP/Getty Images)

COUNTERTERRORISM AUTHORITIES have long been concerned that as the Islamic State loses territory in Iraq and Syria it will seek to establish new bases in other parts of the region. If so, Egypt's Sinai Peninsula is looking like fertile ground for the jihadists. For four years, brutal but inept repression by the regime of Abdel Fatah al-Sissi has served only to strengthen the Islamic State's "Sinai province," made up of Egyptian as well as foreign militants. Last Friday it staged its bloodiest assault yet, killing more than 300 worshipers at a mosque in northern Sinai.

The merciless attack also reflected the incompetence that has characterized Egyptian security forces. A militant commander in Sinai publicly vowed to "eradicate" the al-Rawda mosque, which is affiliated with the Sufi Muslim strain. Weeks before the assault, Islamic State leaflets were distributed in the town threatening Sufis, according to The Post's Sudarsan Raghavan and Heba Farouk Mahfouz. But Egyptian troops, who have saturated northern Sinai under a state of emergency, never deployed in the village of Rawda during Friday prayers — leaving the mosque totally exposed to an assault by some 30 militants who reportedly arrived in pickup trucks.

Mr. Sissi's response was familiar: an angry television speech promising "brute force," a showy bombing raid, and attacks on media reporting. Following the example of President Trump, the foreign ministry assailed CNN for its "deplorable coverage "; the network had the temerity to question why Egyptian authorities have banned most journalists from the Sinai, making independent reporting on the fight against the Islamic State virtually impossible.

Even when reported from a distance, the Sissi regime offers a textbook example of how not to respond to Islamist extremism. The army patrols Sinai in tanks and armored personnel carriers; rather than protecting the population, it is known for summary executions, torture and wanton destruction of civilian infrastructure. In Cairo, the regime has used terrorism as a pretext for the most severe political repression in Egypt's modern history. Tens of thousands of political activists, including prominent secular and liberal figures, have been imprisoned, independent civil society stifled and the media silenced.

Many Egypt experts have pointed to the desperate need for development programs in Sinai to give hope to a restive population. U.S. officials have argued for years for a reorientation of the Egyptian military toward counterterrorism training and tactics. Mr. Sissi is deaf to all such appeals. An Egyptian scholar who presciently warned of the dangers of repression in Sinai, Ismail Alexandrani, has been jailed for more than two years. The regime meanwhile continues to spend billions on tanks, fighter jets, submarines and other conventional gear that is of little or no use against the Islamic State.

Though his administration was compelled by law to cut some aid to Egypt several months ago, Mr. Trump remains a fan of Mr. Sissi. He called the strongman after the Sinai attack and tweeted, inexplicably, that it showed the need for "the WALL" and "the BAN." When it comes to preventing the growth of the Islamic State in Egypt, Mr. Trump and Mr. Sissi are partners in obtuseness.