Iraqi Prime Minister Nouri al-Maliki met with Iranian Supreme Leader Ayatollah Ali Khamenei in Tehran on Thursday to discuss the civil war in Syria and strengthening bilateral ties between the two former enemies.

Maliki is expected to meet with Iranian Foreign Minister Mohammad Javad Zarif and Parliament Speaker Ali Larijani in the coming days.

Although this is the Iraqi prime minister’s first visit to Iran since Iran’s President Hassan Rouhani was elected into office last June, the two were not scheduled to meet, according to Maliki’s spokesman.

“The meeting touched on Syria, and the two sides said the solution should be peaceful and a military option does not represent a solution,” Maliki’s spokesman told the AFP news agency regarding the talks.

His spokesman also said the trip was meant to congratulate Tehran on the signing of a deal with six world powers last month that will ease sanctions on Iran in return for concessions on its nuclear program.

Iran and Iraq, two Shiite-majority countries, have enjoyed close relations since the ouster of the late Iraqi leader Saddam Hussein following the 2003 US-led invasion. Iran also is a major supporter of Syrian President Bashar Assad in the country’s civil war. Iraq has been affected by the ongoing conflict, after Al-Qaeda affiliate the Islamic State of Iraq and the Levant (ISIL) took advantage of the Syrian unrest and launched a number of attacks near the Syria-Iraq border.

Maliki’s visit comes days before Afghan President Hamid Karzai is to visit Iran for talks.