By Isabel Coles
MAKHMOUR, Iraq (Reuters) - Joy and fear were what Um Mahmoud felt when she saw the Iraqi flag for the first time since Islamic State insurgents raised their black banner over her village of Khurbardan nearly two years ago.
The Iraqi flag was waving from a Humvee driven by Iraqi security forces in an offensive touted as the first move in a highly anticipated campaign to liberate the northern province of Nineveh from Islamic State.
It is a battle to win back not only territory, but also the hearts and minds of civilians, many of whom initially welcomed the militants as saviors from a Shi'ite Muslim-led government they perceived as heavy-handed and sectarian.
Many have since come to despise the ultra-hardline Sunni Muslim insurgents, who mete out brutal punishments against their opponents and have brought severe economic hardship on those living in areas they captured in a shock offensive through the north and west of Iraq in 2014-15.
But early signs from the Iraqi army's advance in the Makhmour area suggests regaining popular trust there is likely to be complicated by the fact that Islamic State has embedded itself among local Sunni inhabitants.
This has put them in the army's crosshairs.
Umm Mahmoud, now with her family in a packed youth center housing some 2,000 people displaced by recent fighting, said the "hardest thing about life under Daesh was the hunger", using the pejorative Arabic acronym for Islamic State.
She said "you can't imagine how happy I was" when government forces reappeared, but complained about how some soldiers had dragged mangled corpses of Islamic State fighters in front of her children.
Nearby, a group of displaced men disavowed Islamic State, but also denounced the army for killing civilians in battle and accused some soldiers of mistreating them.
"We suffered because of Daesh, and now the army comes and we should suffer because of them as well?" said 24-year-old Abu Rayyan from Khurbardan.
Two men said they had been rounded up in a room by Iraqi soldiers who then blindfolded, bound and beat them. They displayed wounds to the head, arms and legs as evidence.
"They did not treat us well," said Khalaf Mahmoud, accusing members of the Shi'ite-led security forces of using sectarian slurs. "They said 'you are all Daesh' and that since we stayed with (Islamic State) for a year and a half, we support them."
BATTLE FOR HEARTS AND MINDS
How the mainly Sunni population receives Iraqi forces will help determine the course of the campaign to liberate Mosul - by far the largest city anywhere in the militants' self-proclaimed caliphate that spills across the border into Syria.
To rally people behind them, the insurgents have sought to spread fear among the population in areas they control that returning Iraqi government forces will massacre Sunnis.
Iraqi commanders nonetheless hope that a majority will side with the security forces as they advance on Mosul, which is around 60 km (40 miles) north of Mahkmour and still home to more than one million people.
Abu Rayyan and other several other men blamed elements within the security forces for misconduct. "Unless they get those elements out of the army, all the villages that have not been liberated will become Daesh," he said.
Several people displaced from Khurbardan said the militants, anticipating an attack on the village, had renewed efforts to win favor with residents in recent weeks by providing free canisters of cooking gas.
A man who managed to escape another village in the area before the offensive began said the militants were offering families incentives such as food and cooking gas to move into vacant houses near the front line.
In the days leading up to the army assault, residents of Khurbardan said Islamic State reinforcements arrived, increasing their number in the village to around 50 - both Iraqi and foreign fighters.
They brought in weapons, explosives and suicide bombers, known among Islamic State fighters as "bridegrooms" because of the belief they will go to heaven and marry 72 virgins after "martyrdom".
Trenches and tunnels dug by the militants provide some cover from U.S.-led coalition aircraft, which began pounding Islamic State positions in the region on March 23 in support of the Baghdad government offensive.
Iraqi troops then advanced to retake three villages, whose residents are now sheltering in the youth center.
Men are taken away for questioning by regional Kurdish security services, who fear there may be Islamic State infiltrators among the displaced. It illustrates the challenges Iraqi authorities and aid agencies face in balancing humanitarian needs with security concerns.
The latest displacement of civilians is small in terms of the more than 3 million Iraqis who have been forced from their homes over the past two years, but it foreshadows much greater upheaval to come as security forces bear down on Mosul.
(Editing by Mark Heinrich)