MOSUL, Iraq — The Mosul district of Gogjali was captured from the Islamic State group weeks ago. So the commander of Iraqi troops here was alarmed when a surprise attack by militants sparked an hour-long gunbattle with his forces.

None of his men were hurt, but the assault meant IS sleeper cells remained among the mainly Sunni Muslim population.

Using loudspeakers, troops on Thursday called on all adult men to report to the main square. About 400 showed up. Under heavy guard and forbidden from using cell phones, they sat on the ground — clearly anxious they were about to face mass reprisals.

Instead, the commander delivered a speech, demanding information but also seeking reconciliation.