KABUL, Afghanistan (AP) _ Government soldiers and commanders abandoned the capital under the cover of darkness Thursday, forced out by rocket volleys from fast-advancing rebels seeking to impose strict Islamic rule in Afghanistan.

Earlier in the day, fierce fighting on the city's eastern fringe killed hundreds of combatants on both sides, a Red Cross official said.

With cannons booming in the background, thousands of civilians grabbed what they could carry and jammed buses in a hurried flight from the war zone. In desperation, they spilled out of vehicle doors and even climbed onto bus roofs to escape what they feared would be a massacre.

The fighting pits troops loyal to President Baharunuddin Rabbani against the Taliban, a movement led by ex-seminary students who want to run Afghanistan according to strict Islamic law.

International aid agencies, which have tended to Kabul's battered populace since the Russian-backed Communists were forced out in 1992, evacuated their staff. The Red Cross suspended relief flights after flying out most of the remaining diplomats and aid workers.

``The city is cornered in all four sides and we don't know whether there will be a peaceful takeover like the other places or not,'' said Esther Robertson of the British group, CARE. ``We feel that it is better to go now while we have a chance.''

Although rebel troops had taken up positions in Kabul on Thursday, government jets and helicopter gunships bombed their positions in an effort to keep the Taliban from overrunning the city.

The two biggest pockets of fighting were near a military college six miles from the city center and around the Old Customs house in the suburb of Pul-e-Charkhi. Retreating government soldiers said the Taliban captured the military college, gaining access to a highway to Baghram air base.

By late Thursday, commanders were seen abandoning the city and checkposts remained empty as sporadic gunfire erupted in the city. The streets were deserted.

The Security Ministry, which is normally crowded with soldiers, was empty. Witnesses saw at least six battle tanks carrying soldiers and many trucks crammed with troops heading north from the city toward Baghram air base, Kabul's last air link with the world, 20 miles to the north.

It was not clear if the government was still in control of the mountains around the capital. Gunfire was sporadic on the eastern edge of the city late at night.

Around midnight, fearing the imminent arrival of the Taliban, some residents burned posters of Rabbani and his military chief, Ahmed Shah Masood, in the city's Wazir Akbar Khan neighborhood.

But the government urged residents to rise up against the rebel invasion.

``Either we die or we defend Kabul against the Taliban,'' said Amrullah, a government spokesman, who like many Afghans uses only one name.

``Kabul is not like any other city in Afghanistan for the Taliban to be able to just march in,'' he said. ``Perhaps they will lose thousands of fighters coming to Kabul.''

A government spokesman based in Pakistan said that among the dead was Maulvi Borjan, Taliban's top commander, but a Taliban spokesman denied it.

As rockets smashed Thursday into the Microyan Complex, which houses refugees from previous battles, markets in central Kabul hastily shut, ending residents' last chance to stock up on supplies.

The thunder of heavy artillery and rockets rattled the capital, and panicky soldiers waving Kalashnikov rifles cleared the streets of cars and people, smashing rifle butts into vehicles that didn't move fast enough.

By Thursday afternoon, government troops had dug bunkers at the perimeter of the city to form a second line of defense, backed up by tanks and armored personnel carriers.

The combat zone was strewn with bodies of Taliban fighters, a government spokesman said. The government claimed to have killed 150 rebels, while three of their men were killed and 21 wounded.

A Taliban spokesman claimed, however, that 100 government soldiers were killed in the battle for the military college.

The rebels began their advance on the capital Wednesday after capturing the town of Sarobi. Government jets responded with air strikes.

Rabbani's forces hold only Kabul and a few provinces to the north. Taliban controls about two-thirds of Afghanistan, most of it won without a fight.

In the southern city of Kandahar, Mullah Omar, a senior Taliban commander, announced an amnesty for anyone who surrendered, including Rabbani.

The fighting defied a U.N. Security Council call Wednesday for an immediate cease-fire. Rabbani's spokesman blamed the world body for inaction and warned of the consequences.

``They (the United Nations) can understand that there will be a massacre in Kabul. ... But they are watching it. It is shameful,'' said Amrullah. ``The U.N. means `United Nothing' for Afghanistan.''