KUNDUZ, Afghanistan — When the Soviet Army pulled out of Afghanistan decades ago, it left behind rusty tanks, the wreckage of helicopters and a Ukrainian man who now goes by the name Nek Mohammad.

On Feb. 15, 1989, the last Soviet commanding general in Afghanistan, Boris V. Gromov, walked alone behind the last armored column as it rumbled across a bridge out of the country, and declared that Russia was done here. “That’s it,” General Gromov told a television crew. “Not one Soviet soldier is behind my back.”

In fact, 226 soldiers remained, according to the Russian Cultural Center in Kabul — men who were either still prisoners or had deserted. Mr. Mohammad was one of them, and he has now lived here long enough to see Russia seemingly drawn back into Afghan intrigue.

At the time, though, Russians spoke of having an Afghan Syndrome, like the Vietnam Syndrome in the United States; they wanted nothing to do with the country.

“Russia had a bitter time,” said Mr. Mohammad, who has spent the last 35 years living in various mud-walled homes in northern Afghanistan.

When the Soviet Army left, Mr. Mohammad, who was born as Gennady Tsevma, had little choice but to settle down in Afghanistan. He had been captured by the mujahedeen as an 18-year-old in 1983 after walking off his army base.

Over the years he converted to Islam, married and raised a family, and became a living relic of the high-water mark of Russia’s last period of expansionist foreign policy.

Yet almost from the moment he deserted, he regretted his decision, he suggested in an interview, in Russian, over tea and rock candy in his home in the northern city of Kunduz.

A lawless, mountainous expanse along the borders with the Central Asian states, northern Afghanistan has vast ungoverned territory, home to militia chiefs, heroin smugglers and militants.

Mr. Mohammad dreamed of the sunflower fields of his youth in eastern Ukraine. Out of nostalgia, he taught his wife to stew borscht, something she calls “the red soup.” He struggled for years to end his long odyssey with a homecoming.

“I was sad,” he said. “I worried a lot. I thought I would never return home.”

But he is again in a place where Russian influence is spreading. Afghan officials say that his adopted home, Kunduz, a dusty regional center beneath the Hindu Kush, has been a focal point of Russia’s efforts to again expand its influence in Afghanistan — including reaching out to some elements of the Taliban.

“This position is in no way connected with a wish for bad luck or failure for America,” Yuri Krupnov, a Russian expert on Afghanistan, said of Russia’s renewed interest. He cast it as a logical reaction to concerns that even with a new influx of troops under President Trump’s strategy here, there is no clear path to peace.

“There is an understanding that simply supporting the American policy will not lead to stability,” he said. “And this should surprise nobody.”

In one sign of a creep back in, Russia has taken to spreading disinformation in Afghanistan, mirroring the influence tactics employed in the Ukraine war, and in election meddling in the United States. “Italian forces flee after a fight with the Taliban,” read one recent headline on the Dari-language service of Sputnik, the Russian state news portal.

And, Afghan and American officials have said, Moscow has also taken to clandestinely arming a Taliban group operating around the city of Kunduz. In an interview with the BBC published on Friday, Gen. John W. Nicholson Jr., the commander of American and NATO forces, said, “We know that the Russians are involved.”

The Russian arms are arriving in northern Afghanistan, General Nicholson said in the interview, in his most direct comments to date addressing Russian backing for the Taliban. He suggested the Russian aid signified a return of a superpower proxy war in Afghanistan, and he said the evidence of Russian support was now unequivocal. “We’ve had weapons brought to this headquarters and given to us by Afghan leaders and said, ‘This was given by the Russians to the Taliban.’”

The Russian aid included arranging medical care for the former Taliban “shadow governor” of Kunduz, Mullah Abdul Salam, before his death in a United States drone strike last year, said Nassruddin Saadi, the chief of the Dasht-e-Archi district in Kunduz Province. It was under Mullah Salam that the Taliban briefly seized Kunduz twice, in 2015 and 2016, in assaults that shook the Afghan government and its American allies.

Russia has denied reports that it is arming the insurgent group and asserts that its contacts with the Taliban are intended to encourage resistance to the Islamic State and to join peace talks with the government.

Today, Mr. Mohammad lives less than two miles from villages controlled by a Russian-linked Taliban group, according to a description of the local battle lines offered by Kunduz’s mayor, Najibullah Omerkhel.

In the city, the idea that Russia is courting the Taliban is conventional wisdom. “People say that the Taliban are supported by the Russians,” Mr. Mohammad said. “I never thought they would come back.”

In a story with parallels to that of the American soldier Bowe Bergdahl, who left his military outpost and fell into Taliban hands, Mr. Mohammad also walked away from his unit. He said he was angry after a drunken officer beat him.

The Obama administration traded Sergeant Bergdahl for five Taliban who were released from Guantánamo Bay, and he returned home. But there was no trade for Mr. Mohammad, who is now 53.

Reached by telephone, one of the mujahedeen who captured Mr. Mohammad said the former Soviet soldier willingly joined the fight against his former comrades. “When he became a Muslim, we liked him, so we gave him his rifle back,” said the fighter, Aminullah, who uses only one name. “He was fighting the holy jihad against Russia.”

Mr. Mohammad, in contrast, said he only drove a truck with ammunition. In either case, there was little hope of seeing home again.

“I wrote a letter to my mother,” Mr. Mohammad recalled of the first years after his capture. “I wrote about myself. I said, ‘Mom, this is what happened to me.’ She wrote back, and said, ‘I cried and cried.’”

A mujahedeen commander arranged his marriage to a 14-year-old girl, Bibi Hawa. The couple had six children, two of whom died early; they are still married.

Eight months after the withdrawal, the Soviet Union passed an amnesty for deserters. Mr. Mohammad said he had no money to move his growing family to Ukraine, and anyway didn’t trust the amnesty.

Vyacheslav M. Nekrasov, director of the Russian Cultural Center in Kabul, said Russian consular officials had met Mr. Mohammad. He accepted $2,000 in resettlement aid, but did not move, despite assurances he would not be prosecuted, Mr. Nekrasov said.

In 2012, Mr. Mohammad traveled to his hometown, Amrosiivka, in eastern Ukraine. Mr. Mohammad said he walked in the sunflower fields and felt “sorry that it all turned out this way,” adding, “I missed my home.”

He still entertained hopes of moving his family, though his wife, fearful of living in a strange country, opposed the idea. But the final blow to his dream came when Russian-backed separatists seized his hometown in 2014 during the eastern Ukraine war.

After that, any return now would put him again in de facto Russian hands. And the last of his Ukrainian relatives, a brother and nephew, died in the war in Ukraine.“Nobody is waiting for me now,” he said.

In Kunduz, the Taliban still surround the city; the only way in is on a flight that descends in a steep corkscrew to land on a well-guarded airfield. In town, men in turbans stare warily at strangers. Taliban-held villages are visible from rooftops.

Of the continual fighting around his adopted city, Mr. Mohammad said, “This is normal for Afghanistan.”