Libyan government tanks and snipers put up scattered, last-ditch resistance in Tripoli on Monday after rebels swept into the heart of the capital, cheered on by crowds hailing the end of Muammar Gaddafi's 42 years in power.
The 69-year-old leader, urging civilians to take up arms against rebel "rats", said in an audio broadcast that he was 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 Gaddafi's sons were seized and it was unclear where he was.
Reuters correspondents saw rebel forces hunt sharpshooters from building to building. Sporadic gunfire and shelling kept civilians off the streets, waiting anxiously for the fighting to end after a brief outpouring of jubilation late on Sunday.
"Revolutionaries are positioned everywhere in Tripoli," said a senior rebel in the city, who used the name Abdulrahman.
"But Gaddafi's forces have been trying to resist.
"There is gunfire everywhere," he added, saying government tanks were in action near Tripoli's Mediterranean port and downtown near Gaddafi's Bab al-Aziziya compound. "Snipers are the main problem," he said. "There is a big number of martyrs."
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.
The fall of Gaddafi could also give new heart to embattled opposition groups across the Middle East, notably in Syria.
"Time has run out," said Franco Frattini, foreign minister of Libya's former colonial ruler Italy, adding that Gaddafi's forces now controlled only 10 to 15 percent of the capital.
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."
CALLS FOR CEASEFIRE
State television seemed still to be held by Gaddafi loyalists. "The morale of our troops is high," a presenter said. But children's programing replaced the martial music and images of Gaddafi which have dominated its airtime for months.
In a coordinated move late on Saturday by rebel cells in the capital and assaults on several fronts, Tripoli saw some of the heaviest fighting of the war. A government official told Reuters 376 people on both sides were killed, and about 1,000 wounded, though it was unclear how the figures were arrived at.
Civilians had flocked late on Sunday to Green Square, long the showpiece of the leader's personality cult, waving rebel flags. Some said they would rename it Martyrs' Square.
But early on Monday, rebel spokesman Nouri Echtiwi said, tanks and pick-up trucks mounted with machineguns had emerged from Gaddafi's Bab al-Aziziya compound: "They fired randomly in all directions whenever they heard gunfire," he said.
U.S. President Barack Obama and other Western leaders urged Gaddafi to accept defeat and prepared to work with the rebels -- though the future leadership of Libya remains very unclear.
The European Union, whose members had in recent years resolved disputes with Gaddafi in return for energy supplies, welcomed a "new era": "We are witnessing the last moments of the Gaddafi regime," EU foreign affairs chief Catherine Ashton said. She urged the rebels not to settle scores in blood and to respect human rights and move swiftly toward a new democracy.
South Africa, a leading power on the continent to which Gaddafi devoted much of Libya's wealth and influence, denied it had sent a plane for Gaddafi 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 bloody epilogue to the overthrow of Saddam Hussein in Iraq and warned: "There is a risk for actions of revenge, and uncontrollable violence."
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 to look into restarting facilities, 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.
Two of Gaddafi'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 Gaddafi himself, one of the world's longest ruling leaders, were unknown.
He 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 flags of the government and raised the rebel tricolor last used by the post-colonial monarchy which Gaddafi 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 Muammar Gaddafi."
Gaddafi, 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 in the island of Martha's Vineyard, said in a statement: "The surest way for the bloodshed to end is simple: Muammar Gaddafi and his regime need to recognize that their rule has come to an end. Gaddafi 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 and warned it would bomb any Gaddafi forces who kept on fighting.
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 Gaddafi'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.
Gaddafi'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 Gaddafi'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 Gaddafi's forces.
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.
"There are still plenty of questions," said Anthony Skinner, Middle East analyst, at risk advisers Maplecroft.
"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.
© 2016 Thomson/Reuters. All rights reserved.