In the two weeks since militants from the Islamic State group overran central Ramadi, thousands of people have streamed out of the city, fleeing the brutal clashes between the extremists and Iraqi security forces.

With the announcement late Monday that the Iraqi military has retaken key areas in and around the city, the tide has suddenly shifted: Thousands are turning around and heading back toward Ramadi turning this rickety, makeshift bridge over the Euphrates River into a scene of chaos and clogged traffic.

Through the heat and blinding dust, men and women loaded down with suitcases and bags crossed the bridge west of Baghdad on Tuesday. Some led livestock on ropes. Others pushed carts carrying children or the elderly and a few meager possessions.

Many said they had nowhere to go. In war-weary Iraq, residents of cities like Baghdad view the mostly Sunni residents of Anbar province with suspicion.

One man who was still headed away from Ramadi, the capital of Anbar province, bellowed a warning to those who were streaming back toward it.

"Turn around!" he cautioned as he crossed into Baghdad province. "It's not safe!"

Iraqi security forces — supported by airstrikes from a U.S.-led coalition — have been making gains in recent weeks to take back territory seized last year by extremists from the self-described Islamic State. Iraqi troops were fresh off a victory last month in the city of Tikrit when the militants pushed into Ramadi, endangering the more than 114,000 residents.

Buoyed by the strong air campaign and volunteer fighters, the military made a quick and decisive response in Ramadi. Still, residents took no chances and fled the city in unprecedented numbers.

In the days that followed, however, some changed their mind and believed they were better off at home.

That has spurring the frantic two-way traffic on the bridge — a temporary structure erected in place of one bombed by the militants. The new one was meant to support no more than the occasional fruit-and-vegetable cart heading for Baghdad, whose outskirts are about 65 kilometers (40 miles) to the east.

"We now have more people returning (to Anbar) than those coming," said army Brig. Abdullah Jareh Wahib.

Ambulances were stationed at both ends of the bridge, providing assistance to those who had walked for miles under the intense sun. The bridge rocked over the river's current as residents made their way across.

"We never expected that within a month's time, tens of thousands of people would be crossing the bridge," said Wahib. "The bridge wasn't built for this kind of weight."

More than 1,000 people trying to cross the bridge Sunday into Baghdad province were stopped at the span, the U.N. said Tuesday. Provincial officials were requiring a sponsor to vouch for them before they were admitted to enter Baghdad or allowed to travel toward Iraq's northern Kurdish region, because of fears they may be members of the Islamic State group. Babil province has also prohibited male residents of Anbar province aged 18-50 from entering without similar guarantees.

"We understand that there are members of Daesh trying to infiltrate the province via these displaced people," said Hassan Fedaam, a member of the Babil provincial council, using an Arabic acronym for the IS group.

Saif Mohammed Abbas, 21, evacuated his family last week, but he was among the thousands heading back to Ramadi on Tuesday.

"Mortars were hitting our home and falling on us, so it wasn't safe for them," he said. "But I have to go back. Someone has to look after our home; otherwise, it might get taken or destroyed in the fighting."

Others said they couldn't bear to live in squalor at refugee camps that have struggled to keep up with the growing number of displaced. Some said that for the poorest of Ramadi residents, there are no good choices.

"The poor are in trouble," said Ahmed Saddam, owner of a utilities store in the city. "They have no options. The camps are miserable and life in Ramadi is unbearable."

Thousands continue to pour out of Ramadi, preferring to take no chances as gunfire and airstrikes continue relentlessly.

"Conditions are worsening," said Adrian Edwards, a spokesman for the U.N. refugee agency. "The newly displaced are exhausted. Some people have walked many miles without food or water."

Sabiha Maalim, a woman from the town of Habani, had left her home on Tuesday, saying the IS militants are the least of her worries.

"There were rockets firing all night," she said. "Daesh is hitting the military. The military is hitting Daesh. And we are in the middle. We don't know what our future is."

___

Associated Press writer Sameer N. Yacoub in Baghdad contributed to this story.