The start of an Iraqi and Kurdish offensive to liberate Mosul is a milestone in the defeat the so-called Islamic State. But winning the fight will be hard, and winning the peace far harder. Brutal though ISIS undoubtedly is, Mosul’s residents understandably don’t trust their would-be liberators.

Mosul is Iraq’s second-largest city. A good part of its pre-war population of 1.8 million has fled, but it is nominally nine times larger than Ramadi, from which ISIS was driven after less than a year in early 2016. Mosul is bigger than Philadelphia, the United State’s fifth-largest city.

Moreover, ISIS has controlled Mosul for more than two years, giving it ample opportunity to dig tunnels, lay traps, and fortify positions. Taking Mosul could be urban combat at its worst. And by U.S. estimates, there are more than twice as many ISIS fighters in Mosul as there were in Ramadi.

There’s no doubt who holds the firepower advantage, with U.S. Marines and French forces providing artillery support, U.S. and British special forces operating in the area, and U.S. and allied planes and drones controlling the sky. But as Vietnam showed, firepower isn’t always the answer.

ISIS’ real problem isn’t that it’s outgunned. ISIS’ problem is its Islamist ideology. It genuinely believes that — as its name implies — it is going to build a caliphate, a religious empire. But to do that, it has to control territory. That’s its true weakness.

Guerrillas who try to hold land in the face of a state that has real power to fight back usually get squashed. Mao Tse Tung knew that he had to swim like a fish among the people. So did the Viet Cong, who faded into the jungles as the U.S. Army swept by.

advertisement | advertise on newsday

If you’re trying to overthrow a government, you don’t come out of the wild until you’re sure you can take the capitol. And ISIS has never been close to doing that. But ISIS is compelled by its ideology to break the rules for waging a successful guerrilla war.

With the assistance of U.S. fire support, and 5,000 U.S. trainers and advisers, the Iraqis are likely to take Mosul, albeit slowly and at a considerable cost in civilian and military life. Unfortunately, that’s not where it ends. While ISIS is evil, it’s also a symptom of the failures of the Iraqi state.

Mosul, like ISIS, is predominantly Sunni, while the Iraqi state is dominated by the Shia. Mosul’s inhabitants don’t trust that state, and they trust Shiite militia, some of which are controlled by Iran, even less. They don’t love ISIS, but they fear their government.

It’s not easy to conduct polls in Mosul. But an intrepid Iraqi firm has tried and the results, reported in The Washington Post, make grim reading: 74 percent of Sunnis in Mosul don’t want to be liberated by the Iraqi army, and 100 percent don’t want to be liberated by Shiite militia, or by the Kurds.

Across Iraq, 91 percent of Sunnis believe the government discriminates against them, while 60 percent of Shiites believe the government is fair. That gap created the space for ISIS. Radical Islamists really are motivated by religion. But many more Iraqis, especially Sunnis, are motivated by fear, not Islamism.

You might be relieved by that: if ISIS genuinely commanded millions of hearts, it would be truly terrifying. But yet ISIS has slaughtered its way across the Middle East, and inspired terror around the world, without those millions. It doesn’t need people to love it. It just needs to be the least bad alternative.

Merely taking Mosul won’t make the Iraqi state look any better. As long as the governments of the Middle East are corrupt and sectarian, there will always be another ISIS in embryo. Even a bad government can often beat a guerrilla. But only a good one can ensure there are no guerrillas to beat.

Ted R. Bromund is a senior research fellow in The Heritage Foundation’s Thatcher Center for Freedom.