But residents of Mosul say that so far the Islamic State of Iraq and Syria has handled the local population with a light touch. Some residents, hardened by their hatred of the army, spoke of the insurgents almost as if they were a liberating army. The militants, residents said, greet people at checkpoints and ask citizens if they are carrying a weapon, and if the answer is no, they let them on their way.

Many spoke of being able to move around the city more freely for the first time in years, after the militants unblocked roads that the army had shut down for security reasons and took down the blast walls that had become a permanent feature of nearly every major Iraqi city over the last decade.

“So far, the militants have not harmed any civilians, and they have freed the city from the checkpoints that choke us,” said Ammar Saleh, 32, who works in a hospital in Mosul. Still, he added: “I can’t trust that the gunmen are better than the army. I will leave my family here until things are quiet.”

And the militants’ cordiality toward the local population may not last long. A leaflet, said to be produced by Islamic State of Iraq and Syria and distributed Thursday in Mosul, detailed a long list of coming rules, including the forbidding of alcohol and cigarettes, and requiring women to “stay home and not go out unless necessary.” The leaflet also said that anyone who worked for the government would be killed unless they sought “repentance.”

Whether out of fear of army retaliation or of what life might become under militant control, the crisis has displaced nearly a half-million people, about a quarter of Mosul’s population, according to the International Organization for Migration, to villages in the surrounding countryside, Baghdad, or here in the autonomous Kurdish region.

A mayor who was in charge of a small tent camp for the poorest of Mosul residents said that about 100,000 people had entered Erbil from Mosul in recent days. While many were allowed in, many others were not, especially if they were single men or had no family in the Kurdish region.