Shiite militias are reportedly redrawing Iraq's sectarian geography
Iran is to help Iraq rebuild its army under an agreement that could formalise Tehran's military support for its neighbour.
No details of the pact were released but state television said the two sides had "agreed to continue cooperation in the defence arena with the creation of a national army to protect the territorial integrity and security of Iraq."
The memorandum of understanding was signed late Tuesday in Tehran where Iraqi Defence Minister, Khaled al-Obaidi is holding talks with his Iranian counterpart, Hossein Dahqan.
"The two sides stressed the need for consultations to ensure security, because terrorism affects not only security in Iraq but security throughout the region," the statement added.
The Iraqi military melted in the face of the Islamic State (IS) surge in June, with many soldiers simply abandoning their weapons and uniforms, allowing IS to seize large areas of the country.
Within days, Iran sent military advisers to Iraq to help train and equip troops and allied militias for a counteroffensive against IS.
Iran has also armed Kurdish forces in northern Iraq and several Iranian military personnel have been killed in Iraq and Syria, whose governments Tehran also supports.
However, IS remains in control of Mosul, Iraq's second largest city, as well as much of the Sunni Arab heartland north and west of Baghdad.
Iran has consistently denied having combat troops on the ground in Iraq and was never invited to join the US-led military coalition assembled against IS, dismissing allied air strikes in Iraq and Syria as ineffective.
But earlier this month the Pentagon said Iranian F-4 Phantom jets - acquired from the United States before the 1979 Islamic Revolution - had started attacking IS fighters in eastern Iraq's Diyala province.
Tehran refused to confirm or deny the US military's report.
Diyala lies on Iran's border and Iranian officials have underlined the threat they believe that the IS advance into the province poses for its own security.
They have also said repeatedly that they will not allow any move by IS against the Shiite holy places in Iraq, including the city of Samarra, north of Baghdad, where an Iranian military adviser was killed last week.
Speaking on Monday at the funeral of Revolutionary Guards, Major General Hamid Taghavi, a top security official said that if IS was not tackled in Iraq, Iran itself would be targeted.
"If people like Taghavi don't give their blood in Samarra, we must shed our blood... in Shiraz, Isfahan," Supreme National Security Council Secretary, Ali Shamkhani said, naming two Iranian cities.
Shiite militias redraw Iraq
A powerful Shiite militia with strong ties to Iran is reportedly constructing a road between Shiite areas of Diyala province and Samarra.
“The road is of strategic importance to finish off Islamic State in the outskirts of Diyala and to put pressure on them in Salahuddin," said Badr lawmaker, Mohammed Naji, speaking to Reuters.
"[Badr chief] Hadi Amri suggested this road and he supervises it daily in spite of the dangers.”
Amri, who is also the transport minister, is seen by senior Iraqi politicians as being the closest to Iran on the battlefield.
The construction of the road will allow Badr fighters to easily resupply Samarra with troops.
The move by the group is the latest sign to many Iraqis that Shiite militias are involved in redrawing the sectarian geography of the country.
“The ideas of what Shiitestan’s limits are is changing,” Ali Allawi, a historian and former Iraqi minister told Reuters.
According to the International Rescue Committee, more than 130,000 people, mostly Sunnis, fled central Iraq in 2014, often leaving Shiite armed groups and tribes to fill the empty villages.
“Some of these towns and villages, which were neutral or partial to ISIS, have been retaken. I don’t think the people living there will go back. We are talking about depopulated areas that may be resettled by different groups.”
In early December, Rafi al-Rufai, Iraq’s Sunni mufti, warned that the Shiite militias were “no less dangerous than ISIS.”
“In Iraq there isn’t a genuine government, but there are 32 armed groups that have taken over the country and kill the Sunni population in the name of fighting terrorism,” he said, according to Iraqi Kurdish news agency Rudaw.
“These militia groups kill people based on identity. It has reached a point where Sunnis don’t dare to name their children Omar,” he said, referring to one of the four original Islamic caliphs who is not recognised by Shiite Muslims.