ISIS seized Iraq's second-largest city two years ago. Now a U.S.-supported coalition is fighting to take it back. Here's everything you need to know:

Why is the attack happening now?
Because Iraq's military is finally ready to go on the offensive. Government forces were humiliated by ISIS in June 2014, when some 1,500 jihadists stormed Mosul and routed 20,000 Iraqi soldiers — many of whom panicked and fled, leaving behind their U.S.-supplied weapons and Humvees. Since then, the Obama administration has focused on rebuilding and retraining Iraq's demoralized and dysfunctional army, so that it can capture and hold territory without the help of large numbers of U.S. ground troops or Iran-backed Iraqi Shiite militias. It's crucial that the Iraqi military lead the way in Sunni-majority Mosul, because Shiite militias have previously been accused of killing and abusing Sunni civilians. Atrocities in Mosul could spark a new sectarian uprising against the Shiite-dominated government in Baghdad. So the battle for Mosul will be headed in part by the Iraqi army's 15th Division, which was created after the losses of 2014. Many of its soldiers were members of the units that collapsed in Mosul, and they're hungry for redemption, says Michael Knights, an Iraq expert at the Washington Institute for Near East Policy. "The guys who ran away are coming back."

What's the battle plan?
The offensive is being fought on two fronts. About 4,000 Kurdish peshmerga are fighting to retake a string of ISIS-held villages east of Mosul, with support from U.S. warplanes, artillery, and special operations commandos. The main attack is being launched from Qayyarah air base, some 40 miles south of Mosul, where 560 U.S. military advisers, 22,000 Iraqi government troops, and 6,000 mainly Sunni tribal fighters have gathered in recent months. Backed by coalition air support, liberation forces will advance along the Tigris River, clearing ISIS from towns and villages before reaching the city's edge in early November. Experts say the main urban battle will probably last through December. Much of the battle could be fought street to street and house to house — the winding, narrow streets of Mosul's Old City are inaccessible to tanks or artillery.

Is ISIS ready for the assault?
Its roughly 5,000 fighters in the city have spent months creating an elaborate network of defenses. IEDs have been hidden underneath roads and in buildings, and five bridges have been rigged with explosives. Residents told Reuters that a 6-foot-wide, 6-foot-deep moat has been dug around Mosul's perimeter, which will be filled with oil and set on fire, creating plumes of smoke to make it difficult for warplanes to spot targets. To evade airstrikes, ISIS is funneling men and equipment through underground tunnels. Former Iraqi finance and foreign minister Hoshiyar Zebari says militants are "shaving their beards to blend in with the population and constantly moving their headquarters around." The jihadists are desperately trying to boost their numbers: Local men who refuse to take up arms have had their ears cut off, and locals say children as young as 8 have been handed pistols and knives and ordered to spy on citizens. "I taught my 7-year-old son all about autism to avoid being recruited,'' says one resident.

Will the city's fall hurt ISIS?
With about 1 million remaining residents, Mosul is the most populous city held by ISIS, and its loss will deprive the jihadists of a key source of tax revenue. A defeat in Mosul will also deliver a potentially fatal blow to the extremists' dream of creating a large caliphate across existing nations' borders. At its peak in 2014, ISIS controlled up to 40 percent of Iraq. Thanks to U.S.-lead coalition airstrikes and ground attacks by Iraqi troops and paramilitary fighters, that number has shrunk to 10 percent today. Mosul's location — near oil fields, key trading routes, and the Syrian border — makes it even more critical. Experts believe that the jihadist group's Syrian capital, Raqqa, will be easier to retake once its supply routes from Iraq have been severed.

What will happen in Mosul after ISIS is ousted?
The first challenge will be to stabilize the city and restore trust among its mosaic of sectarian, tribal, and ethnic groups. U.S. and Iraqi officials have spoken of establishing eight self-governing areas in and around Mosul. "These tasks may prove to be more difficult than the battle itself," Knights says. Turkey — a mostly Sunni nation — has some 2,000 troops and two dozen tanks deployed at a base near Mosul and plans to keep them there for another year, supposedly to "fight terrorist organizations" but also to deter Iraq's Shiite-led government from repressing Mosul's Sunnis. Iraqi Prime Minister Haber Haider al-Abadi has warned Turkey that a continued military presence could spark a regional war. The more pressing worry for Mosul's residents, though, is the humanitarian crisis that's almost certain to unfold after liberation.

How bad will it get?
Relief agencies say the battle for Mosul will trigger a mass exodus: Many of the city's remaining residents are expected to flee at once, leaving their possessions behind. "We're facing this enormous tsunami coming at us," says Lise Grande, the United Nations humanitarian coordinator for Iraq. Coalition forces will have to screen out jihadists from the refugees, and, with some 3.3 million Iraqis already displaced by violence, overstretched aid agencies will struggle to feed and house all of Mosul's desperate civilians. Says Matthew Nowery of U.S. relief group Samaritan's Purse, "This is going to be a very large-scale catastrophe."

ISIS's terrorist diaspora
ISIS is on the verge of military defeat in the Middle East — and that could make it an even more dangerous threat to the West. "The so-called caliphate will be crushed," FBI Director James Comey told Congress last month. "The challenge will be that through the fingers of that crush are going to come hundreds of very, very dangerous people." Comey predicts that the group will increasingly try to take the battle to its enemies in the U.S. and Europe, sending Western fighters to stage attacks like those carried out by ISIS-linked terrorists in Paris last November, which killed 130 people. Nicholas Rasmussen, the director of the National Counterterrorism Center, also believes that because the group will no longer need to devote so many resources to maintain its dwindling territory, it will instead focus on recruiting disaffected Muslims in the West to stage lone-wolf attacks. The West is entering "a period of sustained vulnerability," said Rasmussen, "that none of us is comfortable with."