Iran's Armed Forces chief of staff on Wednesday held rare talks with Turkish President Recep Tayyip Erdogan, reportedly focused on the fight against "terror" groups in Syria and Iraq.
Erdogan hosted General Mohammad Hossein Bagheri at his presidential palace in Ankara with Turkey's top general Hulusi Akar also in attendance, the Turkish presidency said.
The state-run Anadolu news agency said the hugely unusual talks lasted 50 minutes, but gave no details.
Reports ahead of Bagheri's three day visit, which began on Tuesday, had said the Iranian general was aiming to coordinate policy on Syria and Iraq.
Relations between overwhelmingly Sunni Muslim Turkey, a secular state, and the mainly Shia Islamic Republic of Iran have on occasion been tense in the last years.
Turkey and Iran lie on opposing sides of the Syrian conflict, with Erdogan seeking the ouster of President Bashar al-Assad to end the war. Tehran, along with Moscow, remain the Syrian leader's key allies and backers.
Erdogan has sometimes lashed out at the rise of "Persian nationalism" in the region, especially concerning the power of Shia militias in Iraq.
But Turkey and Russia have been cooperating more over Syria in recent months, helping to extract civilians from Aleppo and then co-sponsoring peace talks in the Kazakh capital Astana.
Tehran may also share Ankara's concerns about over sway of the Syrian Kurdish People's Protection Units (YPG) in the border area.
Both Turkey and Iran have substantial Kurdish minorities and they vehemently oppose a plan by Iraq's autonomous Kurdish region to organise a vote on independence later this year.
The rise of jihadists in the province of Idlib, neighbouring Turkey, has also alarmed Ankara, Moscow and Tehran.
A senior official from Iran's elite Revolutionary Guards earlier said Bagheri's trip was prompted by the presence of "terrorist groups" in the border area, without saying which ones.
"We are seeking a good agreement with Turkey to provide better security for Iranian and Turkish borders especially in the west and northwest," said Guards spokesman General Ramezan Sharif, quoted by the IRNA news agency.