Iraqi forces are gathering north of Baghdad, aiming to strike back at Sunni Islamists in their drive towards the capital.
An area about 100km north of the capital has become a frontline of the battle with the Islamic State of Iraq and Syria (ISIS) militants, who are also known as ISIL.
Close by in Samarra, the provincial governor, a rare Sunni supporter of Iraq's Shia Prime Minister, told cheering troops they would now force ISIS and its allies back.
A source close to Prime Minister Nouri al-Maliki said that the government planned to hit back now that it had halted the advance by ISIS.
The insurgents seized the main northern city of Mosul, capital of Nineveh province, ten days ago.
They have since swept down along the Sunni-populated Tigris valley towards Baghdad as the US-trained Iraqi army crumbled.
However, the militants' lightning pace slowed in the area north of the capital this week.
Samarra has a major Shia shrine and it is the participation of Shia militias and tens of thousands of new Shia army volunteers that has allowed the Iraqi military to rebound.
It comes after mass desertions by soldiers last week allowed ISIS to carve out territory where it aims to found an Islamic caliphate straddling the Iraqi-Syrian border.
Government forces appeared to be still holding out in the sprawling Baiji oil refinery, the country's largest, 100km north of Samarra, residents said.
At Duluiya, between Samarra and Baghdad, residents said a helicopter strafed and rocketed a number of houses in the early morning, killing a woman.
Police said they had been told by the military that the pilot had been given the wrong coordinates.
Meanwhile, clashes with Sunni militants have killed 34 Iraqi security forces members in Al-Qaim, a town on the Syrian border, officials said.
The fighting broke out late Thursday night and continued until around noon today, with militants in control of most of the town, security forces officers and a local official said.
The identity of the militants was not immediately clear.
But the official, Farhan Farhan, appealed to the government for arms "stronger than the weapons that ISIL has.".
Witnesses said families had begun to flee Al-Qaim.
Militants said to be loyal to Syrian rebel groups took control of the nearby Al-Qaim border crossing on Tuesday, the second crossing the government has lost since 9 June.
Kerry expected to visit Iraq
US Secretary of State John Kerry is expected to travel to Iraq in the near future as part of a wider diplomatic tour of the Middle East and North Africa.
He will hold talks aimed at stabilising the region.
A US official said: "Kerry is expected to go to Iraq soon," but did not give a date.