In this handout photo released by Iraq s National Security press office, Iraq s National Security Advisor Qasim al-Araji (C R) meets with the Secretary of Iran s Supreme National Security Council Ali Shamkhani (C L) in Baghdad on March 19, 2023. AFP
Iraq's autonomous Kurdistan region hosts camps and rear-bases operated by several Iranian Kurdish factions, which Iran has accused of serving Western or Israeli interests in the past.
In November, Iran launched cross-border missile and drone strikes against several of the groups in northern Iraq, accusing them of stoking the nationwide protests triggered by the death in custody last September of Iranian Kurdish woman Mahsa Amini.
Ali Shamkhani, who heads Iran's Supreme National Security Council, inked the deal with his Iraqi counterpart Qassem al-Araji during a visit to Baghdad, the statement said.
It comprises "coordination over the protection of common borders", and will also see the "strengthening of cooperation in several areas of security", the statement from the office of Prime Minister Mohammed Shia al-Sudani added.
Shamkhani denounced "vicious activities by counter-revolutionary elements" in northern Iraq, a reference to the Kurdish groups operating in the country, according to Iran's state news agency IRNA.
He said the agreement signed on Sunday "can completely and fundamentally end the vicious actions of these groups," which the Iranian government labels "terrorist."
After the Iranian strikes, Iraq in November announced it would redeploy federal guards on the border between Iraqi Kurdistan and Iran, rather than leaving the responsibility to Kurdish peshmerga forces -- a move welcomed by Tehran.
Factions based in Iraq's mountainous north have in the past waged an armed insurrection against Tehran, but in recent years their activities have declined and experts said they had ceased nearly all military activity.
Shamkani's visit coincides with the 20th anniversary of the US-led invasion of Iraq that toppled former president Saddam Hussein.
His fall gave birth to a political system that granted the Shia majority dominance over politics.
Many of these Shia factions -- including Sudani's backers in parliament -- are supported by Shia-majority Iran. Relations between the two neighbours have grown ever-closer over the past two decades.
Baghdad had also played a role in mediating a reconciliation between Iran and regional rival Saudi Arabia, hosting several rounds of talks between the two since April 2021.
Riyadh and Tehran had cut all diplomatic ties in 2016 before a surprise Chinese-brokered reconciliation deal was announced earlier this month.
Shamkhani also met the governor of Iraq's central bank and the deputy minister of foreign affairs, according to IRNA.
Tehran is a key trade partner for Baghdad, which in turn is largely dependent on gas and electricity from Iran.