Decades after a bloody war between the countries, Iran offered on Sunday to help Baghdad battle al-Qaeda forces in Iraq.

The offer, made by Deputy Chief of Staff of Iran’s Armed Forces Brig. Gen. Mohammad Hejazi, came hours after al-Qaeda fighters took control of the cities of Fallujah and Ramadi.

“Nothing has been discussed about a joint operation against terrorists, but if Iraqis need equipment and consultation, we will help them,” Hejazi said, according to the state-run Press TV.

Also Sunday, US Secretary of State John Kerry pledged that the US will support Iraq in fighting al-Qaeda, but will not send in US troops.

In a press conference held in Jerusalem, Kerry emphasized that “this is a fight that belongs to the Iraqis. That is exactly what the president and the world decided some time ago when we left Iraq, so we are not, obviously, contemplating returning. We are not contemplating putting boots on the ground. This is their fight. … We will help them in their fight, but this fight, in the end, they will have to win and I am confident they can.”

The losses of Fallujah and Ramadi dealt a blow to the Shi’ite-led government of Iraqi Prime Minister Nouri al-Maliki. Bombings in the Iraqi capital, Baghdad, killed at least 20 people Sunday.

Anbar, a vast desert area on the borders with Syria and Jordan, was the heartland of the Sunni insurgency that rose up against American troops and the Iraqi government after the 2003 US-led invasion that toppled Saddam Hussein.

In 2004, insurgents in Fallujah killed four American security contractors, hanging their burned bodies from a bridge. Ramadi and other cities have remained battlegrounds as sectarian bloodshed has mounted, with Shi’ite militias killing Sunnis.

“We are very, very concerned about the efforts of al-Qaeda and the Islamic State of Iraq in the Levant, which is affiliated with al-Qaeda, who are trying to assert their authority not just in Iraq, but in Syria,” Kerry said.

Though they fought a bruising war in the 1980s, Iran and Iraq, now both led by Shi’ite run governments, have sought closer ties in recent years.

Iran is already thought to wield considerable influence in Syria and Lebanon, through its Hezbollah proxy.