NIAMEY (Reuters) - A loud banging on the door of his Tripoli home told Agali Alambo, a former Nigerien rebel leader who had worked his way into Muammar Gaddafi's inner circle, it was time to get out.
Alambo, now in Niger's capital Niamey, told Reuters in an interview how he had fled the Libyan capital as it was overrun by forces of the anti-Gaddafi National Transitional Council.
"The NTC was in the city, going from neighbourhood to neighbourhood ... They came to my house and they started knocking on the door but I didn't open," Alambo recalled.
"An elderly woman from next door appeared. When she told them there were women inside and to stop hassling them, they became a bit sheepish. I escaped over the roofs."
Before the uprising against Gaddafi, Alambo, 47, had made himself a key part of the ousted leader's security structures. Thousands of his fellow Tuaregs were regulars in Gaddafi's army, a way for them to earn a better living than back home in Niger.
During his flight, Alambo had to use all his considerable contacts and local knowledge of the desert between Libya and its southern neighbour to make good his escape.
His account provides at least some of the back story to the movements across the Libyan border earlier this week that ended with a clutch of ex-Gaddafi loyalists, including three top generals and a security chief, seeking refuge in Niger.
As NATO-backed rebels advanced on Gaddafi's remaining troops, Alambo's story is also that of an intimate circle of officials around Gaddafi that was beginning to fragment.
"For a month or so we'd had no contact with the Guide (Gaddafi), we didn't know where he was. The telephones didn't work and as soon as you switch on the satellite phone you signal to NATO where you are -- so we didn't use them."
Alambo, who before heading to Libya led the Tuareg rebellion against Niger's government between 2007 and 2009, said it was open season on African migrants -- popularly assumed to be pro-Gaddafi mercenaries -- in his Tripoli neighbourhood.
"Four Africans were gunned down 100, 200 metres (yards) from where I lived and their bodies thrown in the courtyard of a clinic there ... It was absolute chaos."
A friend found him a driver and Alambo fled to Bani Walid, the town of his Libyan wife's family and now one of Gaddafi's last strongholds. There he met up with an old acquaintance, Mansour Dhao, the chief of security brigades, and the two agreed to head to the southern town of Sabha.
After a series of hasty meetings with contacts in the city they concluded there was only safe option: escape through Niger.
"The Algerian border to the west was closed, just after Gaddafi's wife and children went through. On the Chad side, I don't know what is going on but a group of (local ethnic) Toubou fighters loyal to the NTC were blocking the way."
The journey of more than 1,000 km (600 miles) south through the desert to the northern Niger city of Agadez took two and a half days. According to Alambo, it was undertaken only after informing authorities in Niger -- a fact which explains the security escort waiting for them by the border last weekend.
"We passed through the Murzuq triangle (desert in southern Libya), the Salvador (border) pass and then straight down to Agadez. We had three vehicles and a fourth came to meet us with more petrol towards the end," he said.
Their arrival and transfer to Niamey has since been confirmed by Nigerien authorities, who says it took them in on humanitarian grounds and has no reason to arrest them.
They are due to be joined in Niamey by a second contingent of Libyan officials who turned up in Agadez late on Thursday, including General Ali Kana, the Tuareg who led Gaddafi's southern troops, airforce chief Ali Sharif al-Rifi, and Murzuq military commander General Mohammed Abydalkarem.
It is unclear what will happen to them next. That could depend on the outcome of meetings with a delegation of NTC officials expected in Niamey in the next few days.
Niger has said that if Gaddafi or his sons showed up, it would respect its commitments to the International Criminal Court, which wants Gaddafi, his son Saif al-Islam and his intelligence chief Abdullah al-Senussi to face trial for alleged crimes against humanity.
Alambo says he has no knowledge now of the whereabouts of Gaddafi, Saif al-Islam or Saadi, another son.
"I can't be sure of anything about Gaddafi's sons," insists Alambo. "I haven't seen then although I heard that Saif al-Islam went up to Bani Walid and then arrived in Sabha around Sept. 3, after us. People said he wanted to carry on resisting ... I didn't see him and I don't know what they are going to do."
(Writing by Mark John; Editing by Alistair Lyon)