The fall of the Ukrainian port of Mariupol to Russia appeared imminent Tuesday as Ukraine moved to abandon the city’s sprawling steel plant, and hundreds of Kyiv fighters who had been holed up there turned themselves over to Russian forces in a deal reached by the warring parties.

The capture of Mariupol, a prewar city of 430,000 people along the north coast of the Sea of Azov, would be Moscow’s biggest success in its nearly three-month offensive against Ukraine.

But Russia is struggling to capture more territory in eastern Ukraine and has failed to topple the government of President Volodymyr Zelenskyy or take the capital, Kyiv.

Under constant Russian shelling, which Ukraine estimates has killed 20,000 civilians in Mariupol, much of the city has been reduced to rubble. What’s left of it is situated between the Russian mainland and the Crimean Peninsula, which Russia seized from Ukraine in 2014.

More than 260 Ukrainian fighters — some of them seriously wounded and lying on stretchers — left the ruins of the Azovstal steel plant on Monday and turned themselves over to Russian forces. Ukrainian authorities said they were working to remove its remaining soldiers from the steel mill, but it was not clear how many remained.

Russia called the operation a mass surrender. The Ukrainians, in contrast, said its garrison had completed its mission.

“Ukraine needs Ukrainian heroes to be alive. It’s our principle,” Zelenskyy said in announcing that troops had begun leaving the mill, with its Cold War-era tunnels and bunkers.

It was not clear what would happen to the Ukrainian fighters. A Russian official cast doubt on a full-scale prisoner exchange.

Fifty-three seriously injured fighters were taken to a hospital in Novoazovsk, east of Mariupol, Ukrainian Deputy Defense Minister Anna Malyar said. Novoazovsk is under the control of Russian troops and Russian-backed separatists.

Another 211 fighters were taken to the town of Olenivka, an area also controlled by Russian-backed separatists, Malyar said, adding that the evacuees would be subject to a potential prisoner exchange with Russia.

During his nightly video address to the nation, Zelenskyy discussed the evacuation of soldiers from Mariupol.

“The operation to rescue the defenders of Mariupol was started by our military and intelligence officers. To bring the boys home, the work continues, and this work needs delicacy. And time.”

Malyar said efforts were being made to rescue the remaining fighters inside the plant, the last stronghold of resistance in Mariupol.

“Thanks to the defenders of Mariupol, Ukraine gained critically important time,” she said. “And they fulfilled all their tasks. But it is impossible to unblock Azovstal by military means.”

Also Monday, Ukraine said its forces had pushed back Russian troops in the Kharkiv region in a counteroffensive that allowed the Ukrainians to reach the Russian border.

The Ukrainian Defense Ministry posted a video showing what it said were its troops at the border, with one soldier telling Zelenskyy, “We are here.”

A senior U.S. defense official said the Ukrainian troops were within 3 or 4 kilometers of the Russian border.

Western countries allied with Ukraine are continuing to send more weaponry to Kyiv’s forces, with 10 deliveries via airlift from seven nations in the past 24 hours, the U.S. defense official told reporters during a background call on Monday.

Some information for this story came from The Associated Press, Agence France-Presse and Reuters.