On the ground in Iraq and Syria, the Islamic State of Iraq and Syria is on the brink of military defeat. Online, however, the group continues to incite its followers to violence, and victory there will take the same kind of sustained effort that anti-terrorist forces brought to the battlefield.

The foremost challenge is to identify individuals susceptible to the terrorists’ messages and intervene before they’re radicalized. U.S. and European officials should enlist the help of local leaders, the private sector and credible voices in Muslim communities.

Over the past two years, there has been quiet progress in reducing the volume of pro-ISIS content on the internet. The military campaign against the organization has certainly damaged its ability to generate propaganda — some of it by as much as 75 percent, according to a West Point analysis. Technology companies also have begun to police their platforms more aggressively, in part due to pressure from European regulators to combat hate speech.

The problem is that they’re often chasing ghosts. ISIS operatives are adept at creating social-media accounts that remain dormant, and undetectable, until the moment they’re activated. Jihadists forced off Twitter and Facebook increasingly communicate on encrypted platforms, such as Telegram and WhatsApp. And even successful efforts to remove terrorist postings are short-lived. Last year, Operation Glowing Symphony, conducted by the National Security Agency and U.S. Cyber Command, wiped out troves of ISIS videos and social-media handles — but most of the content reappeared within days.

What can governments do? They can push technology companies to continue to share with each other the “digital fingerprints” of suspected terrorist accounts. But they should resist imposing mandates on the industry, which could discourage smaller companies from participating.

Governments also should focus not just on reducing the volume of terrorist propaganda but also on supporting compelling alternatives to it. One example is “Black Crows,” a 30-part television drama highlighting women’s resistance to ISIS, which aired during Ramadan on MBC 1, the most-watched satellite network in the Arab world.

Counter-messaging also needs to be integrated with programs that address the radicalization process, which still largely takes place offline — in gyms, schools, prisons and mosques. These are best carried out at the local level, through initiatives such as the Strong Cities Network, which helps mayors and community leaders from 200 localities around the world (including Minneapolis) share data and strategies on how to detect signs of radicalism. Unfortunately, the current administration eliminated the Department of Homeland Security’s funding for such community-based efforts in its 2018 budget proposal.

Congress should restore that funding — and work to convince President Donald Trump’s national-security team of the need to seek local solutions to the threat of global terrorism. It took an army to prevail in the battle for Mosul in Iraq. It will take a lot more than military force to win the war against extremism online.