As Western diplomats scrambled to Kabul airport while the Taliban overran the city last weekend, Russia's embassy there remained demonstratively open and announced its diplomats would work as normal.
It was a sign of how, although seemingly surprised by the speed of the Taliban's takeover as the rest of the world, Russia is now trying to smoothly transition to working with the militants in power.
Russian officials have so far spoken positively of the Taliban, praising them for maintaining order in the capital. Although Russia has said it will not rush to recognize the group as Afghanistan's government, it has signaled it is ready to engage with them.
"The Taliban movement currently controls virtually the entire territory of the country, including its capital. These are realities," Russian President Vladimir Putin said at a press conference with Germany's leader Angela Merkel on Friday. "And we should act based on these very realities, not allowing the Afghan state's breakup."
Russian officials have castigated the fallen American-backed government of Ashraf Ghani and this week Russia's top envoy overseeing its Afghanistan policy, the veteran diplomat Zamir Kabulov, compared the Taliban favorably to the former government.
"If you compare the capacity to make agreements of colleagues and partners, then the Taliban have long seemed to me far more capable than the Kabul puppet government," Kabulov told Russian state television.
Russia has built solid contacts with the Taliban in the past few years as a U.S. withdrawal appeared increasingly likely. It has hosted several rounds of inter-Afghan talks in Moscow that have included the Taliban. In July, a high-level Taliban delegation met with Russia's foreign minister Sergey Lavrov, even though Russia still formally designates the group a terrorist organization, as does the U.S.
Three decades after the Soviet Union's own disastrous intervention into Afghanistan, Russia's overriding concern is that instability in Afghanistan not spread to its Central Asian neighbors Tajikistan and Uzbekistan and that it not again become a base for international terrorist groups to launch attacks.
The Russian government's priority, analysts said, is to ensure an understanding with the Taliban that Moscow is content to engage with them as rulers provided they give security guarantees for Central Asia and pledge to prevent terrorist attacks from its territory.
"It is absolutely clear that Russia will try to have as working relationship with Taliban as possible," said Fyodor Lukyanov, a foreign policy expert and chairman of the Council on Foreign and Defense Policy which sometimes independently advises the Russian government.
"As for the domestic situation in Afghanistan, Russia fortunately has no interests there. There are no stakes inside Afghanistan this time and Russia can relax and limit its reactions to the security interests of the region," he said by phone.
A stable Taliban takeover is also preferable to the Kremlin than a chaotic civil war, even if that means a return to the group's deeply repressive rule, Lukyanov said. But he said he expected Russia would not hurry to formally recognize the Taliban since it would weaken its leverage with the group.
Kabulov told Russian state television this week that so far, the Taliban was observing their agreements with Russia on security for Central Asia.
"It's a hopeful sign," he said. "But we are trusting people of course, but not to that degree. We will carefully follow next steps."
In recent weeks Russia has moved rapidly to bolster Tajikistan, where it has a military base, sending money, weapons and reinforcing border posts. Russia held military exercises this month with Tajikistan and Uzbekistan close to the Afghan border.
'A Risky Bet'
The chaotic images of American defeat this week have prompted predictable gloating in Russian propaganda. Thirty years on from the USSR's own humiliating military withdrawal from Afghanistan, there have been expressions of schadenfreude among Russian officials.
The Kremlin is also glad to see an end to American forces in Central Asia, a long-time goal.
The problem, though, some analysts said, is whether the Taliban will have enough control in Afghanistan to continue to enforce the security guarantees sought by Moscow.
"So far we have a propaganda coup to enjoy, but that may not last," said Vladimir Frolov, a former Russian diplomat and now foreign affairs commentator.
Russia's ideal scenario is that the Taliban now form an inclusive government with other Afghan political groups, but that is viewed as unlikely by many analysts in Moscow. Instead, "drug trafficking and religious extremism will mushroom," journalist, Kirill Krivosheev, wrote in an article for the Carnegie Moscow Center.
That uncertainty means that Russia's foreign ministry risks getting ahead of itself with its public friendliness toward the Taliban, Frolov said.
"I think we made a risky bet on Taliban promises to stabilize the country under their control and not engage in cross-border jihad," said Frolov.
The foreign ministry "will have to prove their bet worked out as promised," he said.