By John Davison

NEAR BASHIQA, Iraq (Reuters) - When Kurdish forces began rounding up his relatives and friends, 23-year-old Iraqi Omar Abdallah fled with his pregnant wife and four brothers to Mosul. At the time, life under Islamic State seemed preferable for the Sunni Arab to indefinite detention.

That was shortly after the ultra-hardline Sunni group captured large areas of northern Iraq in the summer in 2014, and despite its reputation for brutality, Abdallah says it remained a relatively unknown quantity to his family.

Now, Abdallah, Maha and their two infant children have fled again. They huddle in the desert a short distance northeast of Mosul, Iraq's second city, where government forces are fighting to drive out Islamic State in an offensive involving Kurdish fighters and Shi'ite militias.

The family is waiting with hundreds of others near the town of Bashiqa to cross a trench dug by Kurdish peshmerga forces who recently drove the jihadists out of the area.

"We timed our escape well," Abdallah said, explaining how the family moved from central Mosul to a relative's home on the outskirts after the U.S.-backed campaign to regain Islamic State's stronghold began in earnest last month. [nL8N1DI36C]

"When Iraqi forces recaptured the area, we left. Now we just want to go home," he said.

But their hometown of Sheikhan is in an area which has been controlled by the autonomous Kurdistan Regional Government since 2003. It lies on the other side of the trench and a long earth wall that the Kurds erected recently to mark their expanded territory - and could become a permanent new boundary.

Abdallah and his family are among thousands of Sunni Arabs struggling to find their place in an Iraq whose boundaries are shifting along ethnic lines, even before the anticipated defeat of Islamic State.

With Iraq torn by sectarian strife, many Sunni Arabs fleeing Mosul now fear persecution for being perceived to support their fellow Sunnis of Islamic State.

Having experienced Islamic State rule for two years, Abdallah denies sympathizing with the group that he calls by its derogatory Arabic name, Daesh. "Living in Mosul, I kept my head down, grew my beard long and worked as a fruit seller. I tried to avoid any contact with members of Daesh," he said.

Nevertheless, Kurdish suspicions mean the family has found its way home blocked, at least for the moment.

"The peshmerga have searched people here in case there are Daesh fighters hiding among us. We all arrived this morning. They haven't told us when we'll be allowed to cross," he said.

Abdallah said one of his brothers had spent 13 months detained without charge by Kurdish authorities on suspicion of supporting Islamic State.

"After Daesh, the peshmerga began a crackdown," he said, holding his six-month-old son Ali in the back of their pickup truck. The vehicle was piled with blankets, clothes and what other belongings they managed to salvage when fleeing Mosul.

"It's possible I'll be arrested now, especially having lived under Daesh. But that's a risk I'm willing to take to get home," he said. "My parents have never seen their grandchildren. They call every day asking after Ali and Aboudi."

GUARDING THE FRONTIER

Dozens of families, mostly Sunni Arabs, sat patiently in their cars or on tarpaulins in the dust waiting to cross into Kurdish-held territory.

Aid worker David Eubank, who has helped to ferry hundreds of displaced people to camps every night for several days, said they would probably be allowed to cross after dark, and taken to camps or for further security and background checks.

Asked how many people had already crossed the narrow, deep trench in recent days, he said: "We're looking at at least 2,600 people so far."

A peshmerga fighter standing on the other side did not know at what time the displaced would be allowed to cross. "We've just been told to guard the frontier. In the afternoon we search the families and take down their details," he said.

His comrades provided some medical treatment to children, and distributed boxes of food sent by an international aid group.

On the Kurdish side, the peshmerga were digging in for a long stay, ferrying drainage pipes on trucks and tractors and flattening out the dirt road that runs the length of the ditch.

Abdallah is relieved to have escaped the harsh rule of Islamic State, but remains apprehensive. "In Europe, if a migrant from Syria or Iraq blows himself up in a terrorist attack there is a backlash against all migrants. Here, with the Kurds and Arab Daesh sympathizers, it's the same," he said.

REVENGE ATTACKS FEARED

Islamic State has carried out atrocities against numerous ethnic and religious groups including Kurds, Shi'ites and Sunnis.

Abdallah said a neighbor and a friend had been expelled by Kurdish authorities on allegations of being Islamic State supporters. "I also know people - Arabs - whose homes or villages have been destroyed," he added.

Kurdish fighters were recently accused by a human rights group of unlawfully destroying Arab homes in areas they captured from Islamic State between 2014 and May 2016, a charge the Kurdish regional government denies. [nL8N1DE08B]

Abdallah said these actions had in some cases driven Sunni Arabs into the arms of Islamic State, which has claimed to be their protector.

With Kurdish leaders vowing to hold onto areas the peshmerga have seized from Islamic State and Shi'ite militias also making gains elsewhere, he worries about the future of Mosul.

"We're scared that the Shi'ite militias will come into the city, kill men and rape women," he said, echoing Sunni fears of revenge attacks. Shi'ite militias were accused earlier this year of torturing Sunni civilians in areas they had helped to recapture. [nL3N1AS47U]

Iraq's government has tried to ease fears of sectarian bloodshed, saying the army and the police will be the only forces allowed to enter Mosul.

As they wait, Abdallah and his family face an uncertain future. "Our home is just behind that hill, but we can't get there," his cousin Mohammed said, pointing in the distance.

"Sunni Arabs are stuck now," Abdallah said.

With no sign they would be crossing before nightfall, the families began to wrap up in coats and woolly hats as the temperature dropped and the sun set over Mosul.

(editing by David Stamp)