KYIV, Feb 17 (Reuters) - Russian President Vladimir Putin called the capture of Avdiivka "an important victory" after Ukraine's military chief said on Saturday that his troops withdrew from the devastated town in the east of the country after months of intense combat.

Although the Russian defence ministry said that Ukrainian units were still entrenched at the town's coke plant, the advance on Avdiivka was Moscow's biggest advance since it took the city of Bakhmut last May.

It came days before the second anniversary of Russia's full-scale invasion on Ukraine and amidst Ukraine's acute shortages of ammunition with fresh U.S. military aid delayed for months in Congress.

It is also the clearest sign yet of how the tide of the war has turned in Moscow's favour after a Ukrainian counteroffensive failed to break through Russian lines last year.

"The head of state congratulated Russian soldiers on this success, an important victory," the Kremlin said in a statement on its website.

U.S. President Joe Biden warned this week that Avdiivka could fall to Russian forces because of ammunition shortages following months of Republican congressional opposition to a new U.S. military aid package for Kyiv.

A White House statement on Saturday said Biden called Ukrainian President Volodymyr Zelenskiy on Saturday to underscore the U.S. commitment to continue supporting Ukraine and reiterated the need for Congress to urgently pass the package to resupply Ukrainian forces.

The White House said the withdrawal had been forced upon Ukraine "by dwindling supplies as a result of congressional inaction," that had forced Ukrainian soldiers to ration ammunition and resulted in "Russia’s first notable gains in months."

Capturing the city is likely to provide a morale boost for Russia ahead of Putin's bid for re-election next month, which he is almost certain to win.

It is also seen as another step towards securing Moscow's hold on the regional centre of Donetsk, about 20 km (12 miles) to the east, held by Russian and pro-Russian forces since 2014.

Russia has not given details of its losses in the brutal fighting, but Ukrainian officials and Western military analysts say its advances have come at a staggering cost in terms of personnel and armoured vehicles.

Putin's telegram paid tribute to soldiers who had died in the campaign, saying: "Eternal glory to the heroes who fell in fulfilling the tasks of the special military operation!"

Also, it seems that Russia still does not have a full control of the Avdiivka Coke and Chemical plant on the northwestern edge of the town. Ukraine's largest coke producer before the war and now in ruins, it has been the Avdiivka's last stronghold.

"Measures are being taken to completely clear the city of militants and to block Ukrainian units that have left the city and are entrenched at the Avdiivka Coke and Chemical Plant," Russian Defence Ministry Spokesman Igor Konashenkov said in a video published on the ministry's Telegram channel.