A son of Moammar Gadhafi, previously reported captured, made a surprise appearance with jubilant supporters in Tripoli overnight, urging loyalists to fight off rebels who say they control most of the Libyan capital.

Saif al-Islam, seen as his father's chosen successor, visited the Tripoli hotel where foreign journalists are staying to declare that the government was defeating its opponents, Reuters reported.

He took journalists to his father's fortified Bab al-Aziziya bastion in central Tripoli early Tuesday. Saif smiled, waved, shook hands with supporters and flashed victory signs.

We broke the back of the rebels. It was a trap. We gave them a hard time, so we are winning, he said.

Take up arms today, Saif told cheering supporters waiting to be given weapons. Inshallah (God willing), we will attack the rats today.

Later Tuesday morning, explosions were heard near Bab al-Aziziyah, Al Arabiya television reported. An Al Jazeera reporter said rebels were only 500 meters from the dictator's headquarters.

Saif's arrest had been reported both by rebels and the International Criminal Court in The Hague, and his reappearance raised questions about the rebels' credibility.

Saif said Tripoli was in government hands and that he did not care about the arrest warrant issued by the ICC to put him and his father on trial for crimes against humanity.

Asked if his father, who has not been seen in public for weeks, was safe and well in Tripoli, Saif said: Of course.

Saif's reappearance mystified rebels.

We're trying to figure out how he escaped, said one, Muftah Ahmad Uthman. You know the capital was captured really quickly. Many of the men in uniform are volunteers, and some of them make mistakes.

World leaders urged Gadhafi, 69, to surrender to prevent more bloodshed and appealed for an orderly transition of power, as the six-month-old battle for control of the oil-producing North African nation appeared to enter its final stages.

FIREFIGHTS

Rebels swept into Tripoli two days ago in tandem with an uprising within the city. Reuters reporters saw firefights and clashes with heavy weapons, including anti-aircraft guns, as rebels tried to flush out snipers and pockets of resistance.

Hundreds seem to have been killed or wounded since Saturday. But Gadhafi tanks and sharpshooters appeared to hold only small areas, mainly around the Bab al-Aziziyah compound.

Civilians, who had mobbed the streets on Sunday to cheer the end of dictatorship, stayed indoors as machine gun fire and explosions punctuated some of the heaviest fighting of the Arab Spring uprisings that have been reshaping the Middle East.

U.S. President Barack Obama, saying the conflict was not over yet, cautioned rebels against exacting revenge for Gadhafi's brutal rule. 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, Gadhafi 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 Gadhafi allies were still determined to fight, 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 Tuesday, killing dozens of Gadhafi's troops, Al Arabiya TV reported. It did not say where the clash took place. NATO bombed Sirte heavily just before rebels moved into Tripoli.

Bab al-Aziziya, a huge complex where some believe Gadhafi might be hiding, was the focal point of fighting in Tripoli.

I don't imagine the Bab al-Aziziya compound will fall easily and I imagine there will be a fierce fight, Abdel Hafiz Ghoga, spokesman for the rebel National Transitional Council, said in an interview aired by Al-Jazeera.

The Arab network, quoting its correspondent, said violent clashes were also reported near the oil town of Brega.

Rebels had initially said they held three of Gadhafi's sons, including Saif al-Islam. Al-Jazeera TV said that one of them, Mohammed, had escaped, adding that the body of another son, military commander Khamis, might have been found along with that of powerful intelligence chief Abdullah al-Senussi.

FEARS OF REPRISAL, REVENGE

Western powers are concerned that tribal, ethnic and political divisions among the diverse armed groups opposed to Gadhafi could lead to the kind of bloodletting seen in Iraq after the overthrow of Saddam Hussein.

In a move that could ease tensions, a rebel official in the eastern city of Benghazi said, however, that efforts were under way to make contact with authorities hitherto loyal to Gadhafi.

Foreign governments that had hesitated to take sides, among them Gaddafi's Arab neighbors, Russia and China, also made clear his four decades of absolute power were over.

A U.S. State Department spokeswoman said Libyans who said they represented Gaddafi were making more desperate efforts to negotiate with the United States in the last 24 to 48 hours.

Washington did not take any of them seriously because they did not indicate Gadhafi's willingness to step down, she added.

French President Nicolas Sarkozy, who took an early gamble on the rebels and may now reap diplomatic benefits, called on the Gadhafi loyalists to turn their back on the criminal and cynical blindness of their leader by immediately ceasing fire.

Late on Monday, Sarkozy spoke to Britain's David Cameron by telephone about Libya, and they agreed to pursue efforts in supporting the legitimate Libyan authorities as long as Col. Gadhafi refuses to surrender arms, a French statement read. Paris has offered to host a summit on Libya soon.

Cameron also spoke to Obama on Monday night.

OIL PRODUCTION

Western leaders, wary of a possible Iraq-style insurgency by rearguard Gadhafi loyalists, reiterated their refusal to commit military forces to peacekeeping in Libya.

Britain's International Development Secretary Andrew Mitchell told the BBC his country saw no circumstances in which British troops would be deployed on the ground in Libya.

But some governments have had civilian advisers in Benghazi for months, and recent swift rebel advances revived questions about the shadowy role of foreign special forces on the ground.

First signs emerged of moves to begin restoring oil output that has been the basis of the economy and a source of hope for Libya's six million, mostly poor, people. Staff from Italy's Eni arrived to look into restarting facilities, said Foreign Minister Franco Frattini.

He said Italy expects contracts held by Italian companies in Libya to be respected by any new post-Gadhafi government.

Italy's interests in its former colony stretch from oilfields to huge contracts in defense and construction.

They've agreed to honor all contracts, including those with Italian companies, undertaken by Libya, Frattini told Italian radio, referring to the Benghazi-based rebel council. Italy's contracts are with Libya, not with Gadhafi.

Italy is a big customer for Libyan energy. But it will face stiff competition from others seeking a share of Libya's wealth -- a competition some fear could test the ability of untried rebel leaders to hold the country together.

Once Gadhafi's closest European ally, Rome has been courting the rebels since April.

Frattini said the situation in Tripoli remained uncertain.

We certainly have confirmation of a rising presence of the opposition, the so-called rebels, in various neighborhoods of Tripoli, including the international airport area.

This is a time of great confusion, also because there are clashes in some parts of the city; mainly around the fortified compound that has been the refuge -- and presumably still is -- of the dictator Gadhafi, Frattini said, adding that the only people on Gadhafi's side were snipers and mercenaries.

(Reporting by Leon Malherbe in Tripoli, Peter Graff in western Libya, Robert Birsel in Benghazi, William Maclean in London, Hamid Ould Ahmed and Christian Lowe in Algiers, Souhail Karam in Rabat, Richard Valdmanis in Tunis, Laura MacInnis and Alister Bull in Oak Bluffs, Mass., Nour Merza in Dubai, Deepa Babington in Rome and Alexandria Sage in Paris; Writing by Giles Elgood; Editing by Alistair Lyon)