A showdown between Islamic State militants and pro-government militia is looming in the Iraqi city of Ramadi, as thousands flee ahead of the fighting.

IS militants captured the important city in Anbar province last week in what was the Islamist group's biggest victory in almost a year.

Those who have remained are bracing for a bitter conflict as Iraq's government masses Shiite militias to try to take back the city.

But the IS militants have dug in, laying roadside bombs and building fortifications.

In the four days since IS seized control its fighters have also been going house to house searching for members of the police and armed forces.

They group also released about 100 prisoners from the counter-terrorism detention centre in the city.

"Islamic State used loudspeakers urging people who have relatives in prison to gather at the main mosque in the city centre to pick them up," said Saed Hammad al-Dulaimi, 37, a school teacher still in the city.

"I saw men rushing to the mosque to receive their prisoners."

The move could prove popular with residents who have complained that people are often subject to arbitrary detention.

Mr Dulaimi said IS fighters were using cranes to lift blast walls from the streets and bulldozers to shovel away sand barriers built by security forces before they fled.

"I think they (Islamic State) are trying to win the sympathy of people in Ramadi and give them moments of peace and freedom," he said.

Islamic State militants have laid roadside bombs and built fortifications since seizing the city of Ramadi. ( AFP: Aamaq News via YouTube )

The jihadist group said it would set up courts in Ramadi based on Islamic sharia law, as it has done in other captured towns and cities.

Jasim Mohammed, 49, who owns a women's clothing shop, said an IS member had told him he must now sell only traditional Islamic garments

"I had to remove the mannequins and replace them with other means of displaying the clothes. He told me that I shouldn't sell underwear because it's forbidden," he said.

The International Organisation for Migration said 40,000 people had been forced to flee the city — 110 kilometres north-west of Baghdad — in the past four days.

About 500 people were killed in the fighting for Ramadi in recent days, local officials said.

"Nothing is more important right now than helping the people fleeing Ramadi," said the UN's humanitarian coordinator, Lise Grande.

"Thousands of people had to sleep in the open because they didn't have places to stay."

Officials said five displaced people, including two children, died on Tuesday at the Bzeibez bridge where thousands have been waiting to cross into Baghdad governorate.

Fears of sectarian hostility as battle highlights Shia/Sunni divide

Local residents are now bracing for a pitched battle with sectarian overtones because the government has called on Shiite militias, some backed by Iran, to retake the city.

Like the IS group, most of the residents of Ramadi are Sunni Muslims. While some local tribes tried to fight IS, they complained of not receiving enough support from the Shiite-dominated government.

The decision by prime minister Haider al-Abadi, who is a Shiite, to send in the militia, known as Hashid Shaabi or Popular Mobilisation, to try to retake the predominantly Sunni city could add to sectarian hostility in one of the most violent parts of Iraq.

The Abadi government had pledged to equip and train pro-government Sunni tribes with a view to replicating the model applied during the "surge" campaign of 2006-07.

During this time US forces turned the tide against Al Qaeda fighters by arming and paying local tribes in a movement known as the Anbar Awakening.

Loading

But a repeat will be more difficult, with fears weapons provided to Sunni tribes could end up with IS.

When the Iraqi forces beat a hasty retreat from Ramadi at the weekend, they left behind a large amount of military supplies, including about a half a dozen tanks, around 100 wheeled vehicles and some artillery, the Pentagon said.

Asked whether the regular troops should have eliminated such material before quitting the city, Pentagon spokesman Colonel Steve Warren said: "It certainly would have been preferable if they had been destroyed."

The White House said the US-led coalition would support the multi-sectarian ground force in Iraq in its effort to take back Ramadi, including accelerating training and weapons supplies.

US president Barack Obama met with his top national security advisers on Tuesday to discuss the situation in Iraq and the strategy to counter IS militants, the White House National Security Council said on Twitter.

Mr Obama "reaffirmed strong US support" for Mr al-Abadi and the US commitment to the government of Iraq, the White House said.

ABC/wires