Snipers hiding in a mosque and Muammar Gaddafi's favourite summit venue held back Libyan government forces trying to capture his hometown on Thursday, making forecasts of a quick end to the battle look premature.
Thousands of civilians in the town of Sirte are caught up in the fighting. Red Cross workers who were able to reach the town's hospital described patients sheltering from the gunfire in the corridors and a lack of staff to treat them.
Taking Sirte is of huge symbolic importance to Libya's new rulers, and until it is captured they are putting on hold plans to start rebuilding the oil-producing North African state as a democracy.
Once a sleepy fishing town and Gaddafi's birthplace, Sirte was transformed by the former Libyan leader into the country's second capital.
Parliament often sat in Sirte and international summits were held in a marble-clad conference centre in the south of the city, from where fighters loyal to him fired on the attacking forces on Thursday.
Commanders with the National Transitional Council (NTC) have predicted they will have Sirte, a Mediterranean coastal city of 75,000, under their full control by the weekend.
They pledged that units elsewhere on Sirte's outskirts would be brought into the fight on Friday in a coordinated offensive.
But Gaddafi loyalists, many of whom pulled back to Sirte when they lost control of other cities, are putting up fierce resistance. They have nowhere else to go.
A lot of them are veterans, the hard-core fanatics. There's also mercenaries (and) people fiercely loyal to Gaddafi, said Matthew Van Dyke, an American who is fighting with the anti-Gaddafi forces.
They are not going to give up, said Van Dyke, who said he came to Libya seven months ago to visit friends, was arrested by Gaddafi forces, and joined the fighting on his release.
It's going to take a while. (Because of) the snipers, we are going to take a lot of casualties.
Anti-Gaddafi fighters on Thursday had advanced just over one kilometre (miles) into Sirte from the luxury hotel on the Mediterranean shore which had earlier marked the front line.
They were hunkered down in a neighbourhood of villas and five-storey residential blocks from where they were using machine guns and rocket-propelled grenades to try to take out loyalist sniper positions.
They set up firing positions, fortified with sandbags, next to the apartment block windows. But they were taking heavy fire: buildings were riddled with bullets and their balconies had been partially demolished by heavy-calibre rounds.
A Reuters reporter saw a rocket-propelled grenade crash into one of the apartment buildings with NTC fighters inside. It caused little damage because, by a fluke, it passed through a hole made earlier by another projectile.
Anti-Gaddafi fighters used binoculars to watch for muzzle flashes from loyalist sniper rifles.
They said the snipers were positioned in the minaret of a nearby mosque and in the Ouagadougou conference hall.
That is the building where Gaddafi, often decked out in elaborate traditional dress, would host summits of African and Arab heads of state.
An NTC defence spokesman quoted by Al Jazeera television said one of Muammar Gaddafi's sons, Mo'attassem, had left Sirte and fled south. The deposed Libyan leader himself is most likely deep in the south of Libya, in the Sahara desert, according to anti-Gaddafi officials.
The street-by-street fighting was taking place on the northeastern corner of Sirte while anti-Gaddafi forces on the western side of the city held back.
Commanders there were bringing up tanks in preparation for what they said would be a coordinated assault on both fronts.
There is high morale among our boys, Ali Abdullah Ismail, commander of the Zawiyat Al-Mahjoub brigade, told Reuters. Today there will be no ground assault. It's tomorrow. Now they are warming up.
With the NTC focus on Sirte, Libya has been left in a political limbo. It has only a makeshift government and in Tripoli rival armed militias are jockeying for power and influence.
An NTC spokesman said council chairman Mustafa Abdel Jalil would travel to Tripoli on Saturday to handle the delicate situation in the capital.
The battle for Sirte has exacted a high cost for civilians. They have been trapped, with dwindling supplies of food and water and no proper medical facilities to treat the wounded.
Many of Sirte's residents are members of Gaddafi's own tribe. The NTC says there will be a place for them in the new Libya, but the violence in Sirte has caused hostility that it likely to hamper the new government's efforts to unite the country once the fighting is over.
The International Committee of the Red Cross (ICRC) said its team evacuated three wounded from Sirte's Ibn Sina hospital, including a seriously injured nine-year-old girl.
Today there were only a few doctors left to treat war-wounded people in the Sirte hospital, Cordula Wolfisberg, an ICRC doctor who visited the hospital, said in a statement.
Because of the fighting in the area, most patients have been moved from the wards to the corridors. In addition, the hospital is packed with civilians from the neighbourhood, including many women and small children.
Hajj Abdullah, in his late 50s, was at a Red Cross post on the edge of Sirte where food was being handed out. He said he had just escaped the city.
My 11-year-old died from the NATO rockets ... I buried him where he died because it was too dangerous to go to the cemetery, he said. There are random strikes in the city. People are dying in their houses.
He said many civilians were unable to leave. If someone doesn't have petrol and has small kids, what does he do? ... The ones who stayed behind are the poor and the weak.
A NATO spokesman said on Wednesday the alliance's warplanes had not made any strikes on Sirte since last weekend, and that they were doing everything possible to protect civilians.