BLAHODATNE, Ukraine — Ukrainian soldiers swept into the southern city of Kherson on Friday, seizing a major symbolic and strategic prize from the retreating Russian army and dealing a bitter blow to President Vladimir V. Putin.
Just weeks after Mr. Putin declared the Kherson region a part of Russia forever, his troops were forced to abandon its capital city, their third major retreat in the war. The setback further dented the once-formidable reputation of an army that has mismanaged logistics and sent unprepared and unmotivated soldiers into battle.
Wary of mines and navigating around blown-up bridges, Ukrainian soldiers at first filtered secretly into the city and nearby villages, after Russian forces had withdrawn hours earlier across the Dnipro River. But by Friday afternoon soldiers were appearing openly on a central square, greeted by jubilant residents as liberators.
Videos shared by Ukrainian government officials on social media showed scenes of civilians who had endured more than eight months of occupation cheering the arrival of Ukrainian troops. Other videos showed cars driving in the city center beeping horns as people on the sidewalks shouted “Glory to Ukraine!”
“Today is a historic day,” the Ukrainian president, Volodymyr Zelensky, said in a message posted on the Telegram messaging app. “We are returning to Kherson. As of now, our defenders are on the approaches of the city. But special units are already in the city.”
Hours earlier, the Kremlin had issued a statement saying that the withdrawal of its forces across the Dnipro River was complete.
The sense of joy followed an intense period of hardship in the Kherson region. Proxy administrators installed by the Kremlin had made the area perhaps the leading example of the effort to assimilate Ukrainian civilians into Russian life and culture. They required Russian curriculum and language in schools, published Russian newspapers and plastered propaganda posters on walls and billboards.
They also imposed curfews and warned that those who breached them could be shot.
On Friday, a video posted on social media showed local people tearing down one billboard that said, “Russia is here forever!”
Russian soldiers who remained in the city after the defense minister, Sergei K. Shoigu, announced a pullback on Wednesday withdrew by ferries across the Dnipro and over the Antonivsky Bridge, the major river crossing, overnight Thursday into Friday. They then apparently blew up the bridge to cover their retreat, according to residents and satellite images.
By late Friday, it was unclear how many Russian troops remained on the western bank of the Dnipro, an area the two sides fought over in pitched artillery duels for months with Ukraine finally gaining the upper hand — in part by firing Western-provided precision rockets to destroy bridges Russia needed for supply lines.
People still living in Kherson said in text messages and telephone calls that soldiers had been changing into civilian clothes and hiding in abandoned apartments in the chaotic, final days of the occupation. Most residents fled months ago.
The apparent destruction of the Antonivsky Bridge left any Russians remaining in the city with only an ad hoc network of ferries and pontoon bridges across the river. Strategically, it would slow any attempt by Ukrainian forces to pursue enemy troops on the east side of the river.
Though the arrival of Ukrainian troops portended relief for the beleaguered civilians who had remained, officials cautioned that the city was not out of danger. After previous setbacks, Russia has launched bombardments of cruise missiles and drones at Ukrainian cities, and military analysts warned that a Russian response was possible in coming days.
The Ukrainian military said that it believed Russia was preparing to strike the city from new positions across the river, and the government advised residents who had left Kherson not to immediately return.
The loss of Kherson would represent another embarrassing setback for Russia, following retreats from Kyiv, the capital, last spring, and from the Kharkiv region in the northeast in September. Kherson is the only provincial capital Russia had captured, and is a major link in Russia’s effort to control the southern coastline along the Black Sea.
Recapturing Kherson would also bolster the Ukrainian government’s argument that it should press on militarily while it has Russian forces on the run, and not return to the bargaining table, as some American officials have advocated.
Still, it was unclear how many soldiers had entered the city on Friday as Ukrainian reconnaissance scouts moved ahead of the main force. On highways to the west, troops were parked on roadsides, apparently awaiting orders to move forward.
The prospect of Kherson being liberated jolted Ukraine and the Ukrainian diaspora with a wave of excitement, pride and pure joy unlike anything else since the war began. Crowds flooded into the streets of Kyiv; they danced around a glowing bonfire in Kherson; and people popped champagne in Lviv and other Ukrainian cities.
In Poland and Germany, places where Ukrainians driven away by the war have started lives in exile, friends gathered, hugged, sang national songs and poured generous drinks.
“Today is a miracle,” said Olena Yuresko, a bartender in Mykolaiv, a city to the west of Kherson that had been a staging area for Ukrainian troops. “I’ve been checking the news all day on my phone, scrolling, scrolling, scrolling — and crying.”
To celebrate the Russian setback on Friday, the Ukrainian postal service issued a new stamp featuring the prize product of the agricultural heartland in the region around Kherson city: the watermelon.
“Kherson is Ukraine!” the words on the stamp proclaimed. All government agencies changed their official logos to include images of watermelons.
Everywhere Ukrainian soldiers were seen, residents said in telephone interviews, the soldiers were mobbed by crowds wanting to touch them, kiss them, shake their hands.
“It is still difficult to believe this,” said Yuriy Antoshchuk, a resident of Kherson who recently fled the city. “From the inside, I am bursting with pride for all the people of Kherson who have endured this.’’ That was only matched, he said, by “immense, boundless gratitude to the Armed Forces, to whom I mentally bow.”
Only about 30,000 to 60,000 people, based on rough estimates by Ukrainian activists, were left in Kherson city from a prewar population of more than 250,000, and many remained defiant in the face of Russian attempts to turn the region into part of Russia.
Moscow staged a sham referendum in early September, when some residents were forced at gunpoint to vote. Last month, Mr. Putin signed papers claiming to annex the territory.
Even as its soldiers fled, the Kremlin said that it still considered Kherson to be a part of Russia. “This is a Russian region,” Dmitri S. Peskov, the Kremlin’s spokesman, told reporters on Friday. “It has been legally fixed and defined. There can be no changes here.”
Though the Kremlin had presented the withdrawal as an organized retreat intended to save the lives of soldiers cut off from resupply, in villages west of the city there were signs of a hasty pullback and faltering efforts to slow the Ukrainian advance.
Ukrainian soldiers explored one abandoned Russian base, in a warehouse in the village of Blahodatne, poking through heaps of clothes, books and canned goods. Russian military uniforms were crumpled in a heap on the floor of a sleeping area. The beds had been left rumpled. Clothes dried on a clothesline.
Nearby, a warehouse was packed with green wooden boxes holding hundreds of rounds of abandoned Russian mortar ammunition. Some shells had been laid out on the warehouse floor, the detonators already screwed into the explosives, prepared to be fired quickly.
“They left in a hurry,” said Serhiy, a private who asked that only his first name be made public, according to Ukrainian military protocol. “They were preparing to shoot us with this ammunition, but they didn’t have time.”
And remnants of the long battle for the city were seen on the M14 highway leading toward Kherson through villages reclaimed by Ukraine on Wednesday. Along the highway, birch trees had been felled by artillery, telephone cables slumped onto the road and the metal guardrails were twisted and perforated with shrapnel.
Locals described a sense of slumping morale among the Russians stationed in their village, going back months. Maria Akimona, 73, a retired milkmaid, recalled that over the summer, a Russian soldier had told her that he had a 1-year-old son and that he had said, “I won’t see him taking his first steps.”
She added, “I asked him what he was doing here, and he said he didn’t understand.”
The campaign to drive the Russians out of Kherson played out over months, but by Friday afternoon, it become clear the Russians were gone, at least as an organized fighting force.
Andrew E. Kramer reported from Blahodatne, Ukraine and Marc Santora from Kyiv, Ukraine. Reporting was contributed byJeffrey Gettleman from Mykolaiv, Ukraine, and Anna Lukinova and Maria Varenikova from Kyiv.