Libyan rebels battled on Tuesday around Muammar Gaddafi's headquarters, where a son of the veteran leader had emerged overnight to confound reports of his capture and to rally cheering loyalists for a rearguard fightback.
NATO jets flew in support of the rebels, who said they were trying to break into Gaddafi's fortified Bab al-Aziziya compound. His son and presumed heir Saif al-Islam had earlier told a crowd that his father was well and still in Tripoli.
Heavy smoke drifted across the city center and a Reuters correspondent at a government-controlled hotel near the sprawling compound heard heavy gunfire and explosions. NATO declined comment on whether it had struck Bab al-Aziziya.
The revolutionaries are trying to get in through the Old Gate on the western side, rebel fighter Muftah Ahmad Othman told Al-Arabiya television from Tripoli. If they're successful, the fighting will move inside the compound.
Al Jazeera said rebels had the area completely surrounded.
Residents, many of whom had taken to the streets on Sunday to celebrate the end of Gaddafi's 42-year rule, stayed indoors as the irregular rebel armies that swept the capital ran into resistance from sharpshooters, tanks and other heavy weaponry.
Western powers, backing the disparate opposition to Gaddafi, moved ahead with plans to support a new administration with which they hope to exploit Libya's oil wealth. They renewed calls for the 69-year-old autocrat to surrender.
But his London-educated son sounded defiant when, to the surprise of journalists who had been informed by rebel officials that Saif al-Islam was in their custody, he appeared in the early hours to tell cheering supporters: We broke the back of the rebels. It was a trap ... We are winning.
Take up arms today, he urged a small group of loyalists.
God willing, we will attack the rats today.
But few analysts or observers in Tripoli credit Gaddafi's core of supporters with much chance of holding out for long.
It is not an outright victory at this stage, conceded French Defense Minister Gerard Longuet. But he added: The Gaddafi regime is isolated, surrounded and against the wall.
The lack of clear control, however, has revived concerns the sprawling, thinly populated desert state could fall into the kind of instability that has beset Iraq since Saddam Hussein's overthrow. Gaddafi loyalists and anti-Western Islamists could exploit Libya's ethnic, tribal and political divisions.
Rebel officials say they have a force ready to impose order in the capital, as they have generally done in parts of the country they have taken during the six-month-old civil war. But it is not yet clear how they will handle traditional east-west divisions if they consolidate their grip on the country.
The announcements by rebel sources on Monday of the capture of three of Gaddafi's six surviving sons did not enhance their credibility when it turned out that two of them appeared to be free. One official said Saif-al Islam had escaped. Al-Jazeera said another son, Mohammed, had also fled from house arrest.
The uncharacteristically efficient rebel advance into the capital, coordinated with an uprising inside the city, seemed evidence to some analysts of the military advice and training Western and some Arab powers, including Qatar, have provided.
Many assume special forces are also active on the ground.
Outside powers, including U.S. President Barack Obama, have been at pains to characterize the revolt against Gaddafi as quite different from the Western assault on Saddam, saying it is a home-grown uprising inspired by other Arab protest movements that overthrew Western-backed autocrats in Tunisia and Egypt.
Aid, some of it in the form of Libyan state funds seized from accounts controlled by Gaddafi, and advice will be plentiful, foreign governments assured the rebel leadership in Benghazi as it contemplates moving to Tripoli.
But all have ruled out sending in ground troops to bolster a new government which faces considerable difficulties in setting up a new administration given Gaddafi's four-decade reliance on informal governance and a personality cult.
We've sought to learn the lessons of the failures of Iraq, which have very much influenced our thinking -- trying to make sure we don't make the same mistakes again, said British International Development Secretary Andrew Mitchell.
Saif al-Islam, who speaks English fluently, was long the face of his father's rapprochement with an energy-hungry Western world after decades of conflict. But during the course of the war he took a hard line against Gaddafi's enemies.
Hundreds on both sides may have been killed or wounded since Saturday, although reports from rebel and government officials cannot be verified. Medical staff reported difficulties in procuring supplies for those injured.
Obama said on Monday that the conflict was not over yet, and cautioned rebels against exacting revenge: True justice will not come from reprisals and violence, he said.
The president also made plain that the United States would oppose any group within the loose coalition of rebels from imposing its power over other parts of Libyan society.
Above all we will call for an inclusive transition that leads to a democratic Libya, Obama said.
In an audio broadcast on Sunday before state TV went off the air, Gaddafi said he would stay in Tripoli until the end. There has been speculation, however, he might seek refuge in his home region around Sirte, or abroad.
In a sign some of his allies were determined to fight on, NATO said government forces fired three Scud-type missiles from the area of Sirte toward the rebel-held city of Misrata.
Rebels clashed with an army convoy coming from Sirte, killing dozens of Gaddafi's troops on Tuesday, Al-Arabiya TV reported. It did not say where the clash took place. NATO bombed Sirte heavily just before rebels moved into Tripoli.