Russia and Turkey have taken a big step towards normalising ties as Russian President Vladimir Putin met his visiting Turkish counterpart Tayyip Erdogan.
An official in Mr Erdogan's office said there was a clear consensus about improving relations that were damaged when Turkey shot down a Russian warplane near the Syrian border late last year.
"The general mood has been very positive," the official said after the meeting in St Petersburg.
"Your visit today, which you made despite the really complex domestic political situation in Turkey, shows we all want to restart our dialogue and restore our relations," said Mr Putin, addressing Mr Erdogan.
Mr Erdogan's visit is his first foreign trip since the attempted coup, in which more than 240 people were killed.
Turkey has been incensed by the concerns expressed by Washington and European capitals about Ankara's post-coup crackdown but what it sees as indifference to the attempted coup itself.
Mr Putin told Mr Erdogan that he hoped Ankara could fully restore order after a failed military coup last month, saying Moscow always opposed unconstitutional actions.
Mr Erdogan's trip is being closely watched in the West where some fear his relationship with Moscow could affect his links with NATO, of which Turkey is a member.
Mr Putin welcomed Mr Erdogan in a palace just outside his home town and immediately signalled he was ready to improve relations with Turkey, which he said had gone from a historical high point to a very low level.
The Russian president categorically condemned the failed military coup.
"I want to again say that it's our principled position that we are always categorically against any attempts at unconstitutional actions," he said.
"I want to express the hope that under your leadership the Turkish people will cope with this problem (the coup's aftermath) and that order and constitutional legality will be restored."
Mr Putin had said the two men would discuss how to restore trade and economic ties, and cooperation against terrorism.
They were also expected to discuss Syria, a conflict where the two countries find themselves on opposing sides, with Moscow backing President Bashar al-Assad and Ankara wanting him out of power.
Russia imposed trade sanctions on Turkey in the wake of the shooting down of its warplane and the number of Russian tourists visiting the country fell 87% in the first half of 2016.
Mr Erdogan said Turkey was entering a "very different period" in its relations with Russia, and that solidarity between the two countries would help the resolution of regional problems.
German Foreign Minister Frank-Walter Steinmeier told the Bild daily that he was not worried about Russia and Turkey improving ties.
"It is good that after the shooting down of the Russian fighter jet by Turkey last year, there is a rapprochement," he said.
"At the same time I do not believe that relations between the two countries will become so close that Russia can offer Turkey an alternative to the NATO security partnership."