One of Col Muammar Gaddafi's sons, Saif al-Islam, has appeared in Tripoli and claimed the government had "broken the backbone" of the rebel offensive there.
He turned up in a government vehicle at a hotel held by loyalists, a day after the rebels said they had detained him.
A BBC correspondent said Saif al-Islam seemed confident and full of adrenalin.
Our correspondent says fighting in Tripoli has restarted, with the sounds of gunfire and grenades. Both sides say they control most of the capital.
On Monday the rebels met strong resistance from pro-Gaddafi forces as they continued their push.
Rebel leader Mustafa Abdul Jalil claimed fighters were in control of 95% of the city. But the BBC's Matthew Price, in Tripoli, says it is still unclear who is winning the battle for the capital.
Saif al-Islam Gaddafi turned up in the early hours of Tuesday at the Rixos Hotel, where many international journalists are based.
He told the BBC: "We have broken the backbone of the rebels." He added that by moving into Tripoli, the rebels had fallen into "a trap".
"We gave them a hard time, so we're winning," he said.
Saif al-Islam Gaddafi, 39, had been widely regarded as a likely successor to his father. On Sunday the rebels claimed they had captured him, along with other members of his family.
His apparent arrest was confirmed by the International Criminal Court (ICC), which has indicted him, his father and the head of the intelligence service, Abdullah al-Senussi, on war crimes charges.
UK International Development Secretary Andrew Mitchell blamed the "fog of warfare" for the confusion over Saif al-Islam's reported arrest.
"There are quite long lines of communication involved," he told the BBC. "It's inevitable in this situation, with the warfare going on as it is, that there will be some confusion."
Saif al-Islam said he did not care about the ICC arrest warrant.
Asked if Col Gaddafi was safe and in Tripoli, he replied: "Of course."
He also went to his father's Bab al-Azizia compound and told three journalists accompanying him: "Tripoli is under our control. Everyone should rest assured."
The Libyan leader's whereabouts are still unclear. A diplomatic source told the AFP news agency that Col Gaddafi could still be at the compound. He has not been seen in public for months, although he has broadcast audio messages from undisclosed locations.
In a broadcast late on Sunday, he urged residents to "save Tripoli" from the rebels.
Members of the rebels' National Transitional Council (NTC) in Benghazi say they plan to fly to the capital on Wednesday to start work on forming a new government.
A BBC correspondent in Benghazi says there is optimism in their ranks that by the middle of the week Tripoli airport will be secure enough to allow them to move.