A group of 36 Yazidi survivors has been rescued in Iraq after three years of "slavery" under ISIL's rule in northern Iraq, the United Nations said on Sunday.

The group of men, women, and children from the persecuted religious sect was freed by Iraqi forces fighting to retake Mosul from Islamic State of Iraq and the Levant, according to local media.

The women and girls have received lodging, clothing and medical and psychological assistance in Duhok - a Kurdish city north of Mosul, since Friday, Lise Grande, the UN humanitarian coordinator for Iraq, said.

"What these women and girls have endured is unimaginable," Grande said in a statement.

ISIL systematically killed, captured, and enslaved thousands of Yazidis in the summer of 2014 as they overran the Sinjar area, where many of the minority group lived. UN investigators have said that constitutes genocide.

The Yazidis, whose beliefs combine elements from several Middle Eastern religions, were the most persecuted community under ISIL, which considers them devil-worshippers. As many as 1,500 Yazidi women and girls remain in captivity, the UN estimates.

READ MORE: Kurdish-Arab force makes gains against ISIL in Tabqa

After months of fighting to retake western Mosul, a senior Iraqi commander said on Sunday that he expects to dislodge ISIL from its de facto capital in the country some time next month.

The battle should be completed "in a maximum of three weeks", the army's chief of staff, Lieutenant-General Othman al-Ghanimi, was quoted as saying by state-run newspaper al-Sabah on Sunday.

A US-led international coalition is providing air-and-ground support for the offensive in Mosul, the largest city in northern Iraq, which fell to the hardcore fighters in June 2014.

ISIL has lost most of the city's districts since the offensive began in October and is now surrounded in the northwestern districts.

Civilians have paid a heavy price, however.

The Pentagon said on Sunday that investigations conducted during the month of March revealed coalition air strikes killed 45 civilians, mostly in and around Mosul.

In a statement, the Pentagon called the deaths "unintentional".

At least 362 civilians have been killed by coalition raids in Iraq and Syria since the start of the air campaign in 2014, according to the US defence department.

Activists and monitor groups put the number much higher, saying coalition air strikes have killed more than 3,000 civilians in Iraq and Syria since then.

The number of people displaced from Mosul since October is close to 400,000, about a fifth of Mosul's population before its capture by ISIL.

The UN estimates that as many as 500,000 people remain in the area controlled by the fighters, 400,000 of whom are in the historic Old City centre with little food and water and no access to hospitals.

Fighters have dug in among the civilians, often launching deadly counterattacks to repel forces closing in on the Old City's Grand al-Nuri Mosque, from where ISIL leader Abu Bakr al-Baghdadi declared a caliphate over parts of Iraq and Syria in 2014.

Iraqi forces estimate the number of ISIL members still in Mosul at 200 to 300, mostly foreigners, down from nearly 6,000 when the offensive started.

The number of fighters aligned against ISIL in Mosul exceeds 100,000.

Even if defeated in Mosul, ISIL will remain in control of vast swaths of land in the border area with Syria, where Baghdadi is believed to be hiding, according to Iraqi military sources.