By Missy Ryan

TRIPOLI (Reuters) - Grinning, waving in triumph and taunting his father's enemies, Saif al-Islam Gaddafi surfaced in Tripoli overnight to prove he was a free man, not a captive as Libyan rebels had claimed.

His stage-managed appearance for foreign media holed up in the Rixos Hotel in the heart of the capital also suggested the battle for the city is far from over -- and that the Libyan leader Muammar Gaddafi may yet have surprises in store.

Wearing an olive-green T-shirt, Saif took journalists from the hotel to his father's fortified Bab al-Aziziya compound nearby to pour scorn on a weekend push into Tripoli that brought much of the city under rebel control.

"We broke the back of the rebels. It was a trap. We gave them a hard time, so we are winning," he said, clasping hands with jubilant supporters and flashing victory signs.

"Take up arms today. God willing, we will attack the rats today," Saif told them, assuring journalists that his father, who has been in hiding for weeks, was alive and well in Tripoli.

A NATO official said Bab al-Aziziya, where Saif was born, was "definitely not a (NATO) hit" Monday night. But NATO planes flew low over the compound Tuesday and one television station said rebels were attacking the gates.

The emergence of a man often viewed as Gaddafi's choice to succeed him cast doubts on the credibility of the rebels who had announced his capture, along with two of his brothers -- one of whom, Mohammed, has escaped, according to Al Jazeera TV.

Even the office of the prosecutor of the International Criminal Court in The Hague had told Reuters Monday that Saif was in rebel hands. The ICC said Tuesday it had never received official word on this from the Libyan rebel council.

Saif said he did not care about the ICC, which has indicted him and his father for alleged crimes against humanity.

Rebels said they were mystified by Saif's reappearance.

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

Popping up to confound the rebels and their Western backers was a theatrical gesture worthy of a son of Gaddafi, who has often flaunted his eccentricities in 42 years of one-man rule.

Saif, however, with his smooth English and his degree from the London School of Economics, was once widely seen in an energy-hungry West as an acceptable figure who might set Libya on a course of pragmatic reform if he succeeded his father.

But after anti-Gaddafi protests erupted on February 17, Saif's image darkened. He repeatedly denounced the rebels, threatened them with dire punishments and warned there could be "hundreds of thousands of deaths" if protests continued.

"We will never, ever give up. We will never, ever surrender. This is our country. We fight here in Libya," the 39-year-old told Reuters in an interview in Tripoli on March 10.

Saif's latest display of defiance seemed meticulously choreographed to minimize the risk he could be targeted by NATO planes or drones which have the Bab al-Aziziya compound and other strategic targets under round-the clock surveillance.

Libyan officials first insisted that a group of journalists come from the hotel to the compound to meet him and accompany him to the hotel. Once the late-night show was over, a second group of journalists was invited to escort Saif back to Bab al-Aziziya, film him there and then return to the Rixos Hotel

(Additional reporting by Aaron Gray-Block in Amsterdam; Writing by Alistair Lyon)