An Iraqi convoy advances on the outskirts of Mosul ahead of a major battle against the Islamic State. (Ako Rasheed/Reuters)

When Iraqi forces roll toward the city of Mosul this month, local leaders will have an opportunity to close a painful chapter that began more than two years ago, when retreating army units abandoned the city to the Islamic State.

The moment will also mark the culmination of two years of American efforts to build a reliable local fighting force, and present a key test of the Obama administration’s strategy for defeating the Islamic State.

The operation in the northern city, where at least a million civilians remain, is expected to be a complicated and potentially lengthy fight, as Iraqi troops contend with thick militant defenses that include improved explosives, mines, tunnels and trenches.

“ISIS is going to fight harder for Mosul than it has for other places, because it’s a crown jewel,” said Jessica Lewis McFate, a scholar at the Institute for the Study of War. ISIS is an acronym for the Islamic State.

The stakes are high not just for Iraqi Prime Minister Haider al-Abadi, looking for a win that would shore up his political standing, but also for President Obama, who is seeking to deliver a battlefield win in the waning days of his presidency.

How the Islamic State is using scorched earth tactics as it retreats

For the U.S. military, victory in Mosul would be an affirmation of its incrementally expanding role in Iraq, where commanders have overseen a gradual troop buildup and added new elements to the U.S. mission, including lower-level advising and use of attack helicopters that may expose U.S. troops to greater risk.

It would also validate the administration’s decision to allow militants to dominate Mosul for two years, rather pushing for an earlier offensive or asking the Iraqi government to permit an American combat role, while foreign advisers scrambled to train local units.

Ahead of the final assault, American and allied planes are pounding the city in a bid to weaken militants. In the past two weeks alone, at least 66 strikes have hit sites around Mosul, said Col. John Dorrian, a U.S. military spokesman in Baghdad. “The enemy is not going to be allowed to dig in at their leisure,” he said.

Ahead of the operation, Iraqi and coalition forces have positioned themselves at key staging points around Mosul, including Makhmour, to the southeast, and Qayyarah, joined by American and allied advisers who in some cases will accompany them as they push toward Islamic State lines.

Military leaders have sought to stress that the U.S. advisory role in the Mosul offensive will be far different than it was prior to the 2011 withdrawal, when American troops nominally operated in support of local forces but in practice led much of the combat operations themselves.

In the latest deployment, the Pentagon last month again increased the number of U.S. troops, bringing it to well above 5,000. One key task for those troops will be helping Iraqi leaders orchestrate the movements of a large, fractious force that will include up to 12 Iraqi army brigades and tribal fighters aided in the broader Mosul operation by Kurdish peshmerga and powerful Shiite militia factions.

“The U.S. strategy of by, with and through [local forces] will culminate in Mosul, and hopefully in Raqqa not too long thereafter,” a defense official said, like other officials speaking on the condition of anonymity to speak freely.

Other American troops will advise Iraqi units in the field. Under current battle rules, U.S. advisers can accompany local forces at the battalion level, which would place them closer to direct combat, with authorization.

“It’s risky advising at that level, we know that,” an administration official said. “But again, it’s one decision that we think will help provide more effective coordination.”

U.S. advisers will also accompany troops from Iraq’s elite Counterterrorism Service, who as in previous battles are expected to spearhead the assault into the city.

Other measures the White House approved in the lead-up to Mosul, including Apache attack helicopters and HIMARS long-range artillery systems, are expected to play a key role in the final dash toward Mosul.

At the same time, American commanders will be anxious to minimize U.S. casualties in a conflict that has received only reluctant support in Washington. Since U.S. forces returned in 2014, three American service members have died in combat operations.

For U.S. military officials, another key element of the strategy has been the quest to reform a beleaguered Iraqi army. Officials say Iraqi morale is far better than it was in May 2015, when local troops beat a hasty retreat out of the city of Ramadi in another important setback.

Many leaders have been replaced, needed equipment has been provided, and operations alongside U.S. advisers have provided new confidence, officials say. “We’ve prepared them for a tough fight,” another defense official said.

But many of the Iraqi victories against the Islamic State were made possible by the fighting power of Iranian-backed Shiite militiamen whose prominence has created another dilemma for the Obama administration. This time, U.S. and Iraqi officials suggest, those forces will remain outside the urban area.

Ramzy Mardini, a fellow with the Atlantic Council, said that the absence of militia might within Mosul may make Iraqi troops more reliant on U.S. and allied air power, as they were in the battle to recapture Ramadi.

There, Iraqi forces “didn’t have the capacity in size to recapture Ramadi without the overwhelming air power provided by the coalition,” he said. “The result is that the city was destroyed.”

American officials said they have laid extensive plans to protect the city during its air campaign and especially its inhabitants in the operation. U.S. and U.N. officials are also racing to make preparations for potentially hundreds of thousands of displaced people.

Perhaps the biggest test for the U.S. strategy will follow the battle. While U.S. officials say a force of 45,000 police and tribal factions will secure the city, no clear plans for governing the historically diverse city have emerged. Whoever they are, Mosul’s new leaders will have to contend with the likelihood of residual militant attacks and the potential for renewed local conflict.

McFate cautioned that a win in Mosul would be an important but partial victory against the militants, who may try to fall back to other areas of Nineveh, where they have enjoyed support, or across the border to Syria.

Military officials are planning for a possible attempt by militants to flee westward, toward their de facto capital of Raqqa, possibly using civilians as a human shield, setting the stage for a final battle in Syria.

“Reclaiming Mosul would be a significant gain,” she said. “But it will not sufficiently eliminate ISIS from Iraq, nor will it eliminate it from Raqqa.”