Turkish President Tayyip Erdogan meets with Iran's Chief of Staff Major General Mohammad Baqeri in Ankara, Turkey August 16, 2017. Kayhan Ozer/Presidential Palace/Handout via REUTERS

ANKARA (Reuters) - Turkey and Iran have agreed to boost military cooperation after talks in Ankara this week between the Iranian armed forces chief of staff and Turkish leaders, President Tayyip Erdogan’s spokesman said on Thursday.

Iran’s military chief General Mohammad Baqeri met Erdogan on Wednesday on a visit Turkish media said was the first to Turkey by an Iranian military chief of staff since the 1979 Islamic revolution in Iran.

Erdogan spokesman Ibrahim Kalin described the visit as “fruitful and successful”, adding that talks focused on counter-terrorism, the battle with Islamic State, and a joint effort by Iran, Turkey and Russia to stem the fighting in parts of Syria.

“An agreement was reached to hold further high-level visits from now on,” Kalin told a news conference. “A series of activities will also be held to boost military cooperation.”

Baqeri’s trip to Ankara came days ahead of a planned visit by U.S. Defense Secretary Jim Mattis. Ties between NATO allies Turkey and the United States have been strained by Washington’s support for Kurdish YPG fighters leading the assault on Islamic State in the Syrian city of Raqqa.

Turkey says the YPG is indistinguishable from the outlawed Kurdish PKK which has been waging an insurgency in southeast Turkey for more than 30 years. Washington sees it as a vital ally in the fight to defeat Islamic State.

Iran’s semi-official Tasnim news agency quoted Baqeri as saying he had agreed with Turkey to hold joint training courses, and increase counter-terrorism intelligence sharing.

He said Erdogan would visit Iran in the near future.