At a camp near Baghdad housing Shiite families who fled the Islamic State group, the mobile homes are stocked with heaters and get more electricity than residents of the capital. Some donated food is even refused.

But that's not the case everywhere in Iraq. Some of those who have run for their lives from the militants still go hungry, or they are turned away from towns where they seek shelter.

With a U.N.-estimated 1.8 million Iraqis pushed from their homes this year by the war with the Islamic State group, the country upended by the 2003 U.S.-led invasion finds itself splintering again along ethnic and religious lines.

The camps are not officially divided by sect. But they often end up that way, either because those fleeing their homes want to move in with people of the same community or because a particular camp's residents may have all fled from the same towns, dominated by a single community. While the Shiite-led provincial administration of Baghdad has thrown considerable help to the Shiites in Nabi Younis camp, many others are in squalid conditions, whether in the capital or in the northern Kurdish autonomy region.

The Shiites "feel more comfortable and safer in this camp because they live among their brothers from the same sect," said Ali Heleil, an official in charge of Nabi Younis near the eastern suburbs of Baghdad. "The Shiite people living around the camp are helpful to those people."

Iraq, a mixture of Sunnis, Shiites, Kurds and other ethnic and religious minorities, saw a similar migration amid the worst of its sectarian bloodshed between 2006 and 2008. Mixed neighborhoods in Baghdad emptied out as death squads roamed the streets and dozens of bound bodies with gunshot wounds turned up each day. Things slowly improved after the U.S. troop surge, but tensions always simmered just below the surface, especially as security forces cracked down on Sunni protests of their claims of marginalization by the federal government.

The lightning advance in August by the Sunni militants of the Islamic State group reopened those wounds. Centuries-old communities of religious minorities — some viewed as apostates by the Islamic State group extremists — fled for their lives. Christians, Yazidis and many Sunni Muslims headed to the Kurdish-held north, while many Shiites chose to go south to the Shiite-majority areas.

Many Arab refugees said the Kurdish regional government turned them away in order to maintain a Kurdish majority for an eventually independent country. Shiite militias that rose up to defend Baghdad and important shrines often harassed and detained fleeing Sunnis.

The quality of the aid often depends on the location. The United Nations Office for the Coordination of Humanitarian Affairs estimates about 2.2 million people need urgent humanitarian aid in places held by the Islamic State group, like beleaguered Anbar province. It also estimates that up to 80 percent of the displaced people now living in Kurdish-held areas need winter clothes.

Those in the Nabi Younis camp, however, enjoy more electricity than the average resident of Baghdad. About 385 Shiite families have lived in the camp's 200 mobile homes since August. Each trailer has heating and access to tap water. The camp also has its own medical clinic. Children play soccer on a nearby field, and women take classes on hairdressing and operating computers.

"I worked as a hairdresser in my town," said Huda Mohammed, who was attending class. "I will try to start a business here."

The camp is supervised by the Baghdad provincial council. Its residents are under the protection of the central government and, in particular, the heavy-handed Shiite militias that have been deployed around Baghdad looking to stave off the militant advance. Police also protect the camp, manning two checkpoints to screen anyone trying to enter.

While trying to help the displaced Iraqis, the U.N. and aid groups have acknowledged the sectarian tensions. A U.N. report Sunday noted how Kurdish authorities stopped 215 Arab families from Salahuddin province from entering Kurdish-held towns.

"A number of governorates across the country impose restrictions on the entrance of Iraqi displaced people," it said.

Yet even with the level of care at Nabi Younis, those living there still dream of returning home, although they realize their towns probably have been destroyed.

"We have been told that our house was booby-trapped," said Sahra Mahmoud, 27, who fled with her three young girls to Baghdad and has no plans to return home to their village near Mosul. "The fear and death will always stay with us there."