Angela Merkel met Russian President Vladimir Putin in Moscow on Friday, as Germany's chancellor nears the end of her 15-year leadership.
While Germany has worked to extract its diplomats from Afghanistan, Russia is keeping its embassy in Kabul open and has a role as gatekeeper to Central Asia for the Afghans.
Speaking about Afghanistan and the departure of US-led forces after almost 20 years, Mr Putin said the “irresponsible politics of imposing foreign values from outside must be stopped".
“It is important now to prevent the incursion of any kind of terrorists to the countries neighbouring Afghanistan, including in the form of refugees,” he added.
Welcoming Mrs Merkel to the Kremlin, Mr Putin said Germany is Russia's second largest economic and trade partner, after China.
“Germany remains one of Russia’s main partners, both in Europe and in the world,” he said.
“We have many issues that require a discussion in a personal format. So I am sure that this will not only be a farewell visit, given your decision not to run for another term as federal chancellor, but also a visit filled with serious, down-to-business content.”
Mrs Merkel’s trip comes during a low point in the relationship between the two countries, with tensions over Moscow's treatment of opposition politician Alexei Navalny and Russian aggression towards Ukraine.
While the two leaders have long had their political differences, relations have soured in particular since the beginning of Ukraine conflict in 2014 and the Russian annexation of Crimea.
But, while many in the West have sought to isolate Mr Putin, Mrs Merkel has managed to maintain a line of communication over the years.
“I am very, very glad, with all the differences of opinion that we have today, between Russia and the German government, that we are talking to each other, and today's visit was about exactly that,” Mrs Merkel said after her meeting with Mr Putin.
“And it was a constructive conversation, a conversation that highlighted differences, but also approaches for common solutions that we want to find,” she said.
It was doctors in Germany who said Mr Navalny, currently imprisoned in Russia, had been poisoned last year. Mr Navalny has blamed Russia, which denies the accusations.
“I have once again called on the Russian president to release Alexei Navalny, and I have also made it clear that we will stay on the case,” said Mrs Merkel.
Her spokesman Steffen Seibert said on Wednesday that Mr Navalny's case “puts great strain on our relationship to Russia”.
“Our demands have still not been met. You will also know that Mr Navalny is unjustly imprisoned, spends his sentence in a penal camp and that there are even new charges being raised against him.
“All these points weigh on the relationship between Germany and Russia,” Mr Seibert said.
Berlin has been criticised by some European countries, such as Ukraine, over the nearly completed Nord Stream 2 pipeline that will carry natural gas from Russia to Germany.
While the US – which had opposed the project – and Germany announced a deal last month to allow its completion, critics say the pipeline threatens European energy security, heightens Russia's influence and poses risks to Ukraine and Poland in bypassing both countries.
Volodymyr Zelensky, the president of Ukraine, has described the pipeline as a “powerful weapon being given to Russia”.
Mrs Merkel's Russia visit will be one of her last trips abroad as chancellor, as the 67-year-old will not run for office again in next month's national election.
Mr Putin, 68, who has been in power for more than 20 years, is Russia's longest-serving leader since Joseph Stalin.
He worked for Soviet intelligence service the KGB in the former East Germany.