Vastly outnumbered and outgunned, several hundred Chechen rebels today relinquished control of the Presidential Palace here, the stronghold from which they had held off a ferocious assault by thousands of Russian troops for nearly three weeks.

The last defenders left the 11-story building shortly after midnight, about 10 hours after it was rocked by a pair of powerful Russian bombs that penetrated to the basement hospital, killing dozens of Chechens and wounded Russian prisoners. Hours after the Chechens slipped out of the palace under cover of darkness, the Russians moved in and hoisted their blue-red-and-white flag over the shell-shattered building in central Grozny, Moscow announced.

For the Russians, taking control of the palace was a symbolically important victory after weeks of heavy casualties and humiliating setbacks in their drive to crush the Chechens' three-year-old struggle for independence from Moscow. Nevertheless, the rebels have vowed to continue the fight in southern parts of the city they still control as well as in the Caucasus Mountains farther south.

In Moscow, Russian President Boris Yeltsin declared the military stage of the battle "practically complete" and said the government would soon begin the process of withdrawing army forces and having Interior Ministry troops take over. In a statement issued this evening, Yeltsin said "conditions are now being created for the transition from armed confrontation to restoring peaceful life in Chechnya within the Russian Federation. Transition to the stage of civil construction and restoring constitutional order begins." But Chechen militia commanders said this evening that they had simply shifted their forces about a mile south in a tactical retreat within Grozny. "We haven't left the city, and we'll never leave the city," Akhmed Zubhadjieyev, 27, acting chief of the Presidential Guard, said in an interview at his home just outside Grozny's city limits. "We would have had huge losses if we'd stayed in the palace," he said, as the sound of heavy explosions reverberated in the distance. "We just couldn't fight from there any longer."

Chechen leader Dzhokhar Dudayev, a former Soviet air force general, was not in the palace when it was abandoned. Last seen in public a week ago, he is believed to be alive and accompanied by his bodyguards, but his whereabouts are unknown.

Yeltsin's statement offered condolences to the families of combatants and civilians killed in the fighting and said the government would "take all measures to do away with the after-effects of the economic ruin and supply the population with all it needs for normal life." It also promised to provide "complete protection of human rights."

But Yeltsin also signaled his intention to get tough with those Russians who did not support his decision to oust Dudayev by force. The Russian news agency Interfax, quoting a high-ranking military source, reported today that Yeltsin had signed a decree transferring Col. Gen. Eduard Vorobyev from his army post into the reserves.

Vorobyev, first deputy commander of Russia's land forces, had refused to head the Chechen operation last month because he felt the troops were unprepared for battle. Vorobyev's offer of resignation was refused at the time. Earlier this week, Russia's acting prosecutor general said Vorobyev was one of several high military officials being "checked" for failing to obey orders.

Yeltsin also issued a decree today replacing three deputy defense ministers who are said to have criticized Defense Minister Pavel Grachev, Interfax reported. Among those who lost their positions is Col. Gen. Boris Gromov, the former Soviet commander in Afghanistan who has been an outspoken critic of the Chechen operation. The only civilian deputy defense minister, Andrei Kokoshin, retained his post. The Defense Ministry, meanwhile, announced today that it would no longer send raw recruits into the Chechen conflict. The sight of poorly trained young men, some only a few weeks into their army tours, being mowed down during the fighting has fueled outrage in Moscow.

With the collapse of resistance in the Presidential Palace -- the former Soviet Communist Party headquarters -- Moscow also seemed in no mood to bargain in any way with Dudayev. Prime Minister Viktor Chernomyrdin, who just two days ago was meeting with a Chechen delegation to discuss the possibility of a cease-fire, today bluntly ruled out any further negotiations with Dudayev. "I do not talk to gangsters," Chernomyrdin said.

According to Chechen leaders, their withdrawal from the palace was as well organized and executed as the defense they have mounted since the Russian offensive began Dec. 11. Starting at about 10 p.m. Wednesday, the rebels fired rocket-propelled grenades at Russian forces a few hundred yards away to cover their retreating comrades, who left the palace in five main groups.

Zubhadjieyev, the Presidential Guard chief, said about 600 Chechen defenders had slipped from the palace. But Col. Aslan Maskhadov, the Chechens' top commander, said in a news conference this evening in Nazran, capital of the neighboring region of Ingushetia, that only 320 rebels left the palace. Neither man showed any willingess to abandon the struggle against Russian rule.

After three weeks of tightening their grip on Grozny, the Russians launched a full-fledged assault on the city on New Year's Eve but were repulsed by the Chechens in furious fighting. The conflict has caused heavy casualties on both sides, and civilian deaths and injuries are believed to number many thousands, largely because of Russian bombing and rocket attacks.

Throughout the fight for the city, the palace has been a symbol of the rebels' pride and defiance. Although hammered by hundreds, perhaps thousands, of heavy artillery and mortar shells, tank rounds and rockets launched from both the air and the ground, the Chechens kept the Russians at bay.

The palace was set afire at least three times and was without heat, lights and working plumbing. Still, it was in some ways a perfect stronghold for the Chechens. Sturdily built and surrounded by open plazas that became a killing field for approaching Russian troops, the palace seemed nearly impregnable.

But at about 2 p.m. Wednesday, the two heavy bombs slammed into the building, crashing through several floors and exploding in the basement, where scores of Chechen rebels were huddled and more than 100 Russian prisoners, some of them wounded, were being held.

According to Zubhadjieyev, who had been in the palace since New Year's Eve, between 50 and 60 people were killed in the blasts, including at least 30 Russian prisoners and 20 Chechens. He said the explosions were far more powerful than anything else that had hit the palace in 19 days of bombardment.

In fact, he said, casualties inside the palace since the New Year's Eve assault had been relatively light -- perhaps 10 dead and 20 wounded. Several other Chechens said the bombs may have been specially designed to penetrate thick layers of concrete before detonating. "The previous bombing and shelling didn't bother us so much," Zubhadjieyev said. "But the heavy bombs Wednesday changed the situation."

Around 10 p.m. Wednesday, Maskhadov, the Chechens' overall commander, issued the order to abandon the palace and other buildings held by the rebels immediately around Grozny's Freedom Square.

"We left the building by my orders," Maskhadov, a former Soviet army commander in Hungary, said in Nazran. "We took all the wounded soldiers with us."

The Chechens said they were able to withdraw from the palace without heavy casualties despite the thousands of Russian troops who had pressed to within a few hundred yards of the building on three sides.

"It took about five minutes for each group of 100 men to leave," said Zubhadjieyev. "We were in white camouflage. No one was shooting. The whole thing took about two hours." Zubhadjieyev said he and his 22 Presidential Guards were the last to leave.

It was apparently sometime in the morning before Russian troops advanced cautiously toward the empty building. Reports said the Russian tricolor was not raised over the building until this afternoon. Like most Chechen combatants, Zubhadjieyev expressed disdain for the Russian troops who took control of the palace. "Their morale is terrible and so is their quality," he said, claiming he had killed more than 70 Russians with his Dragunov sniper rifle. "I don't think it will be any harder to fight against the Russians now," he added. "They're not going to win; there's no question about it. ... We have not lost the city. Napoleon managed to take Moscow, but look what happened to him afterward."

Correspondent Margaret Shapiro in Moscow contributed to this report.