Libyan rebel fighters
Libyan rebel fighters ride through the town of Maia celebrating after advancing to the outskirts of Tripoli, August 21, 2011. Bob Strong

Moammar Gadhafi's put up scattered, last-ditch resistance in Tripoli Monday after rebels swept into the heart of the Libyan capital, cheered on by crowds hailing the end of his 42-year rule.

The 69-year-old leader, urging civilians to take up arms against rebel rats, said in an audio broadcast that he was still in the city and would be with you until the end. But there was little sign of popular opposition to the rebel offensive, two of Gadhafi's sons were seized and it was unclear where he was.

Gadhafi is finished. Now we are free, one rebel, named Abdullah, told a Reuters reporter over the sound of gunfire and shelling, as his group consolidated its position to the west of the city center after an overnight dash into the capital.

World leaders were in no doubt that, after six months of an often meandering revolt backed by NATO air power, the disparate and often fractious rebel alliance was about to take control of the North African desert state and its extensive oil reserves.

Some warned of a risk of a longer, anarchic civil war after what has been the bloodiest of the Arab Spring uprisings inspired by the overthrow of autocrats in Tunisia and Egypt.

Time has run out, said Franco Frattini, foreign minister of former colonial power Italy, adding that Gadhafi's forces now controlled no more than 10 or 15 percent of the capital.

Fighters from the irregular opposition forces moved from building to building, hunting sharpshooters. Civilians came out in celebration on Sunday after a coordinated move by rebel cells in Tripoli late on Saturday but stayed indoors on Monday.

Rebel spokesman Nouri Echtiwi said by telephone that tanks and pick-up trucks mounted with machineguns had emerged from Gadhafi's Bab al-Aziziya compound: They fired randomly in all directions whenever they heard gunfire, he said.

U.S. President Barack Obama urged Gadhafi to accept defeat as sporadic gunbattles crackled across Tripoli. The European Union, whose members had in recent years resolved disputes with Gadhafi in return for energy supplies, said his time was up.

We seem to be witnessing the last moments of the Gadhafi regime and call on Gadhafi to step down without further delay and avoid further bloodshed, an EU spokesman said.

We have post-Gadhafi planning going on.

WATCHING HISTORY

South Africa, a leading power on the continent to which Gadhafi devoted much of Libya's wealth and influence, denied it had sent a plane for Gadhafi or was planning to shelter a leader who has been indicted for crimes against humanity by the International Criminal Court in The Hague.

Sweden's prime minister Fredrik Reinfeldt said: We are watching history.

But he cited the example of the overthrow of Saddam Hussein in Iraq and warned: There is a risk for actions of revenge, and uncontrollable violence. These are tribal groups who are fighting against their oppressors. One knows what one is against, but it is not always equally clear what one is for and people can be for different things.

First signs emerged of moves to begin restoring oil production that has been the foundation of the Libyan economy. Technical staff of Italy's oil and gas major Eni arrived in Libya to look into restarting facilities, Italian Foreign Minister Franco Frattini said.

In China and Russia, both powerful critics of the NATO war launched in March in support of the rebels, officials agreed that Libya appeared to have new masters. In Beijing, the foreign ministry said it would respect the people's choice.

Late on Sunday, rebels waving opposition flags and firing into the air drove into Green Square, a symbolic showcase the government had until recently used for mass demonstrations in support of the now embattled Gadhafi. Rebels immediately began calling it Martyrs Square.

Two of Gadhafi's sons, including Saif al-Islam who was once seen as heir apparent and a potential friend of the West were captured by the rebels. But the whereabouts of Gadhafi himself, one of the world's longest ruling leaders, were unknown.

Laila Jawad, 36, who works at a Tripoli nursery, told Reuters after the rebels arrived: We are about to be delivered from the tyrant's rule. It's a new thing for me. I am very optimistic. Praise be to God.

REBEL CONVOY

The rebels made their entrance into the capital driving in convoy through a western neighborhood.

Gadhafi earlier had made two audio addresses over state television calling on Libyans to fight off the rebels. I am afraid if we don't act, they will burn Tripoli, he said. There will be no more water, food, electricity or freedom.

But resistance to the rebels faded away. Near Green Square youths burned the green, Islamic flags of the government and raised the rebel tricolor last used by the post-colonial monarchy which Gadhafi overthrew in a military coup in 1969.

Many Tripoli residents received a text message from the rebel leadership saying: God is Great. We congratulate the Libyan people on the fall of Moammar Gadhafi.

Gadhafi, a colorful and often brutal autocrat, said he was breaking out weapons stores to arm civilians. His spokesman, Moussa Ibrahim, predicted a violent reckoning by the rebels.

A massacre will be committed inside Tripoli if one side wins now, because the rebels have come with such hatred, such vendetta, Ibrahim said on Sunday. Even if the leader leaves or steps down now, there will be a massacre.

Obama, on vacation on the island of Martha's Vineyard, said in a statement: The surest way for the bloodshed to end is simple: Moammar Gadhafi and his regime need to recognize that their rule has come to an end. Gadhafi needs to acknowledge the reality that he no longer controls Libya. He needs to relinquish power once and for all.

NATO said the transition of power must be peaceful.

TRIPOLI FALLS QUICKLY

After civil war that became a stalemate in the desert for long periods, rebels raced into Tripoli, with a carefully orchestrated uprising launched on Saturday night to coincide with the advance of rebel troops on three fronts. Fighting broke out after the call to prayer from the mosques.

Rebel National Transitional Council Coordinator Adel Dabbechi confirmed that Gadhafi's younger son Saif al-Islam had been captured. The ICC, which wants him along with his father on charges of crimes against humanity, confirmed he had been held and said he should be handed over for trial.

Gadhafi's eldest son Mohammed had surrendered to rebel forces, Dabbechi told Reuters. In a television interview, Mohammed said gunmen had surrounded his house. He told Al-Jazeera in a phone call that he and his family were unharmed.

Only five months ago Gadhafi's forces were set to crush the rebel stronghold of Benghazi in the far east of the vast and thinly populated North African state of six million. He warned then that there would be no mercy, no pity for his opponents. His forces, he said, would hunt them down district to district, alley to alley, house to house, room to room.

The United Nations then acted quickly, pushed notably by French President Nicolas Sarkozy, clearing the way for the creation of a no-fly zone that NATO, with a campaign of bombing, used ultimately to help drive back Gadhfi's forces.

It's over. Gadhafi's finished, said Saad Djebbar, former legal adviser to the Libyan government.

In Benghazi, thousands gathered in a central square. They waved red, black and green opposition and trampled on pictures of Gaddafi as news filtered through of rebel triumphs.

Mohammed Derah, a Libyan activist in Tripoli, told Al-Jazeera: This is another day, a new page in Libya's history. We are witnessing a new dawn and a new history of freedom.

Celebratory gunfire and explosions rang out over the capital and cars blaring their horns crowded onto the streets. Overhead, red tracer bullets darted into a black sky.

There are still plenty of questions, said Anthony Skinner, Middle East analyst, Maplecroft. What happens next?

We know there have been some serious divisions between the rebel movement and we don't know yet if they will be able to form a cohesive front to run the country.

Just last month, the rebels military commander was killed after being taken into custody by fighters from his own side.

A Libyan government official told Reuters that 376 people on both sides of the conflict were killed in fighting overnight on Saturday in Tripoli, with about 1,000 others wounded.

(Reporting by Missy Ryan and Ulf Laessing in Tripoli, Michael Georgy and Peter Graff in western Libya, Robert Birsel in Benghazi, Libya, William Maclean in London, Hamid Ould Ahmed and Christian Lowe in Algiers, Souhail Karam in Rabat, Richard Valdmanis and Giles Elgood in Tunis, Laura MacInnis and Alister Bull in Oak Bluffs, Mass., Michael Roddy and Keith Weir in London; Writing by Giles Elgood and Alastair Macdonald)