The war, which began in 1979, left more than 13,000 Soviets dead and may have killed as many as one million Afghans.
"It's like fighting sand. No force in the world can get the better of the Afghans," Oleg Kubanov, a former officer, said at an anniversary concert in Moscow.
"It's their holy land, it doesn't matter to them if you're Russian, American. We're all soldiers to them."
The war contributed to the takeover of Afghanistan by the Taliban and the collapse of the Soviet Union.
On February 15, 1989, the last Soviet soldier left Afghanistan, ending a war that Moscow initially expected to be a brief incursion to bolster its Afghan supporters.
During the Soviet invasion, Russia's military found itself bogged down in an unwinnable guerrilla war against the Mujahidin, Islamic fighters who were backed by the US and Saudi Arabia.
The last Soviet soldier to leave was the commander of its forces in Afghanistan, Lieutenant General Boris Gromov, who crossed the Friendship Bridge across the Amu Darya river into Soviet Uzbekistan at midday on February 15.
"I am convinced of one thing. That it is irresponsible to forget about lessons like Afghanistan," Gromov, now the governor of the Moscow region, told Russia's Rossiskaya Gazeta daily.
The US, which led its own invasion of Afghanistan in 2001, is preparing to pour more troops into the country in an attempt to tackle a surge in Taliban-led violence
Russian veterans have warned that the US is set to relive the nightmare faced by the Soviet forces.
"They'll send more in and they'll lose more," Andrei Bandarenko, a former special forces officer, said of the US plans.
"What does Obama [the US president] know about the situation on the ground?"
Shamil Tyukteyev, who lead a regiment in Afghanistan between 1986 and 1988, also said that the extra troops would only make the situation worse.
"You can't put a soldier outside every house or a base on every mountain. We saw it ourselves, the more troops, the more resistance," he said.
A study released on Friday showed that 47 per cent of Russians believed that the invasion of Afghanistan was a "political adventure into which the political leadership irresponsibly led the country".
Of those polled, 58 per cent believed there was never a reason to put Soviet troops into Afghanistan.
But several officials have also sought to argue that the losses were not in vain and have praised the "heroism" of the Red Army in Afghanistan.
|Commemorative ceremonies were also held in other former Soviet countries [AFP]
"The soldiers were true to the oath of military duty and brotherhood and showed manliness and courage as the Russian army has always done," Yuri Luzhkov, Moscow's mayor, said.
The anniversary commemorations coincide with moves by an increasingly resurgent Moscow to restore its influence in the former Soviet lands of central Asia after its war with Georgia last year.
It has offered Kyrgyzstan a $2bn loan to help it through the economic crisis and strongly backed Uzbekistan in a water dispute with ailing Tajikistan.
The probability that Kyrgyzstan will shut a US air base that served as a vital supply point for supplies to Afghanistan has prompted Nato and the US to seek alternative methods of supplying materials.
Russia has agreed to allow the transit of non-lethal supplies by land and has said it could even consider air transit as well.