TRIPOLI (Reuters) - Colonel Muammar Gaddafi's regime was delivered by a caterer, on a memory stick.
But in the first few weeks of the uprising, he secretly began to work for the rebels. He recruited sympathisers at the nerve centre of the Gaddafi government, pinpointed its weak links and its command-and-control strength in Tripoli, and passed that information onto the rebel leadership on a series of flash memory cards.
The first was handed to him, he says, by Gaddafi military intelligence and security officers. It contained information about seven key operations rooms in the capital, including internal security, the Gaddafi revolutionary committees, the popular guards -- as Gaddafi's voluntary armed militia was known -- and military intelligence.
The data included names of the commanders of those units, how many people worked in each centre and how they worked, as well as crucial details like the number plates of their cars, and how each unit communicated with the central command led by intelligence chief Abdullah al-Senussi and Gaddafi's second son Saif al-Islam.
That memory card -- which Mlegta later handed to officials at the North Atlantic Treaty Organisation (NATO) -- provided the basis of a sophisticated plan to topple the Libyan dictator and seize Tripoli. The operation, which took months of planning, involved secretly arming rebel units inside the capital. Those units would help NATO destroy strategic targets in the city -- operation rooms, safe houses, military barracks, police stations, armoured cars, radars and telephone centres. At an agreed time, the units would then rise up as rebels attacked from all sides.
The rebels called the plan Operation Dawn Mermaid. This is the inside story -- much of it never before told -- of how that plan unfolded.
The rebels were not alone. British operatives infiltrated Tripoli and planted radio equipment to help target air strikes and avoid killing civilians, according to U.S. and allied sources. The French supplied training and transport for new weapons. Washington helped at a critical late point by adding two extra Predator drones to the skies over Tripoli, improving NATO's ability to strike. Also vital, say western and rebel officials, was the covert support of Arab states such as the United Arab Emirates and Qatar. Doha gave weapons, military training and money to the rebels.
By the time the rebels were ready for the final assault, they were so confident of success that they openly named the date and time of the attack: Saturday, Aug. 20, at 8 p.m., just after most people in Tripoli broke their Ramadan fast.
"We didn't make it a secret," said Mohammed Gula, who led a pro-rebel political cell in central Tripoli and spoke to Reuters as rebels first entered Gaddafi's Bab al-Aziziyah compound. "We said it out on the street. People didn't believe us. They believe us now."
THE DIGITAL GIFT
Planning began in April, two months into the uprising. Rebel leader Mahmoud Jibril and three other senior insurgents met in the Tunisian city of Djerba, according to both Mlegta and another senior official from the National Transitional Council (NTC), as the alternative rebel government calls itself.
The three were Mlegta, who by then had fled Tripoli and joined the rebels as the head of a brigade; Ahmed Mustafa al-Majbary, who was head of logistics and supplies; and Othman Abdel-Jalil, a scientist who became coordinator of the Tripoli plan.
Before he fled, Mlegta had spent just under two months working inside the regime, building up a network of sympathisers. At first, 14 of Gaddafi's officers were prepared to help. By the end there were 72, Mlegta says. "We used to meet at my house and sometimes at the houses of two other officers... We preserved the secrecy of our work and it was in coordination with the NTC executive committee."
Brigadier General Abdulsalam Alhasi, commander of the rebels' main operation centre in Benghazi, said those secretly helping the rebels were "police, security, military, even some people from the cabinet; many, many people. They gave us information and gave instructions to the people working with them, somehow to support the revolution."
One of those was al-Barani Ashkal, commander-in-chief of the guard at Gaddaffi's military compound in the suburbs of Tripoli. Like many, Ashkal wanted to defect, but was asked by the NTC to remain in his post where, Alhasi says, he would become instrumental in helping the rebels enter the city.
The rebel planning committee -- another four men would join later, making seven in all -- knew that the targets on the memory sticks were the key to crippling Gaddafi's forces. The men included Hisham abu Hajar, chief commander of the Tripoli Brigade, Usama Abu Ras, who liaised with some cells inside Tripoli, and Rashed Suwan, who helped financially and coordinated with the tribes of Tripoli to ease the rebels' entry.
According to Mlegta and to Hisham Buhagiar, a rebel colonel and the committee's seventh member, the group initially drew up a list of 120 sites for NATO to target in the days leading up to their attack.
Rebel leaders discussed their idea with French President Nicolas Sarkozy at a meeting at the Elysee Palace on April 20.
That meeting was one of five in Paris in April and May, according to Mlegta. Most were attended by the chiefs of staff of NATO countries involved in the bombing campaign, which had begun in March, as well as military officials from Qatar and the United Arab Emirates.
After presenting the rebels' plan "from A to Z", Mlegta handed NATO officials three memory cards: the one packed with information about regime strongholds in Tripoli; another with updated information on regime sites as well as details of 65 Gaddafi officers sympatheric to the rebels who had been secretly supplied with NATO radiophones; and a third which contained the plot to take Tripoli.
Sarkozy expressed enthusiasm for the plan, according to Mlegta and the senior NTC official, who spoke on condition of anonymity.
The leaders slimmed the 120 targets down to 82 and "assigned 2,000 armed men to go into Tripoli and 6,000 unarmed to go out (onto the streets) in the uprising," according to rebel colonel Buhagiar. He joined the opposition National Front for the Salvation of Libya in 1981 and has lived in the United States and trained as a special forces operative in both Sudan and Iraq.
There were already anti-Gaddafi cells in the capital that the rebels knew they could activate. "The problem was that we needed time," the senior NTC official said. "We feared that some units may go out into the streets in a spontaneous way and they would be quashed. We also needed time to smuggle weapons, fighters and boats."
In the early months of the uprising, pro-rebel fighters had slipped out of Tripoli and made their way to the north-western city of Misrata, where they were trained for the uprising, rebels in Misrata told Reuters in June. The leaders of two rebel units said "hundreds" of Tripoli residents had begun slipping back into the city by mid-July. Commander Alhasi and other rebel officers in Benghazi said the number of infiltrators sent into Tripoli was dozens, not hundreds.
"This was not D-Day," Alhasi told Reuters in his office.
"THE OVERSEAS BRIGADE"
Most of the infiltrators travelled to Tripoli by fishing trawler, according to Alhasi. They were equipped with light weapons -- rifles and sub-machineguns -- hand grenades, demolition charges and radios.
"We could call them and they could call each other," Alhasi said. "Most of them were volunteers, from all parts of Libya, and Libyans from overseas. Everybody wants to do something for the success of the revolution."
Although Tripoli was ostensibly under the control of Gaddafi loyalists, rebels said the security system was porous: bribery or other ruses could be used to get in and out. Small groups of men also began probing the government's security system with nighttime attacks on checkpoints, according to one operative who talked to Reuters in June.
It was possible to smuggle weapons into Tripoli, but it was easier and less risky -- if far more expensive -- to buy them from Gaddafi loyalists looking to make a profit before the regime collapsed. The going rate for a Kalashnikov in Tripoli was $5,000 over the summer; in Misrata the same weapon cost $3,000.
Morale got a boost when rebels broke into government communication channels and recorded 2,000 calls between the regime's top leadership, including a few with Gaddafi's sons, on everything from military orders to sex. The NTC mined the taped calls for information and broadcast some of them on rebel TV, a move that frightened the regime, according to the senior NTC source. "They knew then that we had infiltrated and broken into their ranks."
Recordings of two of the calls were also handed to the International Criminal Court. One featured Gaddafi's prime minister al-Baghdadi al-Mahmoudi threatening to burn the family of Abdel Rahman Shalgham, a one-time Libyan ambassador to the United Nations and an early defector to the rebels. Al-Mahmoudi described Shalgham as a slave. The other was between al-Mahmoudi and Tayeb al-Safi, minister of economy and trade; the pair joked about how the Gaddafi brigades would rape the women of Zawiyah when they entered the town.
Several allied and U.S. officials, as well as a source close to the Libyan rebels, said that around the beginning of May, foreign military trainers including British, French and Italian operatives, as well as representatives from Qatar and the United Arab Emirates, began to organise serious efforts to hone the rebels into a more effective fighting force.
Most of the training happened in the rebel-held Western Mountains. But Eric Denece, a former French intelligence operative and now Director of the French Centre for Research on Intelligence, says an elite rebel force of fighters from the east was trained both inside and outside Libya, at NATO bases and those of other allies. This "overseas brigade" was then dropped back into the country. In all, estimated Denece, some 100-200 foreign operatives were sent to Libya, where they focused on training and military coordination. Mlegta confirms that number.
FRENCH DROPS, BRITISH INFILTRATION
Rebel commander Alhasi insists western special forces were not involved in combat; the main help they gave was with the bombing campaign and training. London, Paris and Washington also say their troops were not involved in combat.
"They complied with our (bombing) requirements, immediately sometimes, sometimes we had a delay," said Alhasi, who has a big satellite photograph of Tripoli on one of his walls. "We had the information on the ground about the targets and relayed it to them."
A European official knowledgeable about such operations said "dozens" of plain-clothes French military advisers were sent to Libya. A French official said between 30 and 40 "military advisers" helped organise the rebels and trained them on basic weapons and more high-tech hardware.
In May, the French began smuggling weapons into western Libya. French military spokesmen later confirmed these arms drops, saying they were justified as "humanitarian support", but also briefing that the aim was to prepare for an advance on Tripoli.
British undercover personnel carried out some of the most important on-the-ground missions by allied forces before the fall of Tripoli, U.S. and allied officials told Reuters.
One of their key tasks, according to allied officials, was planting radio equipment to help allied forces target Gaddafi's military forces and command-and-control centres. This involved dangerous missions to infiltrate the capital, locate specific potential targets and then plant equipment so bomber planes could precisely target munitions, destroying sensitive targets without killing bystanders.
In mid-March, a month after violent resistance to Gaddafi's rule first erupted, President Obama had signed a sweeping top secret order, known as a covert operations "finding", which gave broad authorisation to the CIA to support the rebels.
But while the general authorisation encompassed a wide variety of possible measures, the presidential finding required the CIA to come back to the White House for specific permissions to move ahead and help them. Several U.S. officials said that, because of concerns about the rebels' disorganisation, internal politics, and limited paramilitary capabilities, clandestine U.S. support on the ground never went much beyond intelligence collection.
U.S. officials acknowledge that as rebel forces closed in on Tripoli, such intelligence "collection" efforts by the CIA and other American agencies in Libya became very extensive and included efforts to help the rebels and other NATO allies track down Gaddafi and his entourage. But the Obama administration's intention, the officials indicated, was that if any such intelligence fell into American hands it would be passed onto others.
A senior U.S. defence official disclosed to Reuters details of a legal opinion showing the Pentagon would not be able to supply lethal aid to the rebels -- even with the U.S. recognition of the NTC.
"It was a legal judgment that the quasi-recognition that we gave to the NTC as the legitimate representative of the Libyan people didn't check the legal box to authorise us to be providing lethal assistance under the Arms Export Control Act," the senior official said.
HELP FROM THE GULF
In some ways the rebels' most unlikely ally was Qatar.
The Gulf Arab state is keen to downplay its role, perhaps understandably given that it is ruled by an absolute monarch. But on the ground, signs abounded of the emirate's support. The weapons and equipment the French brought in were mostly supplied by Qatar, according to rebel sources. In May, a Reuters reporter saw equipment in boxes clearly stamped "Qatar." It included mortar kits, military fatigues, radios and binoculars. At another location, Reuters saw new anti-tank missiles.
Qatar's decision to supply arms to the rebellion, one source close to the NTC told Reuters, was instigated by influential Libyan Islamist scholar Ali Salabi, who sought refuge in Qatar after fleeing Libya in the late 1990s. He had previously worked with Gaddafi's son Saif, to help rehabilitate Libyans who had fought in Afghanistan. Salabi's brother Ismael is also a leader of a rebel militia in Libya.
Salabi "is the link to the influential figures in Qatar, and convinced the Qataris to get involved," said the source close to the NTC.
By early June, Libya seemed locked in a stalemate.
After three months of civil war, rebels had seized huge swathes of territory, but NATO bombing had failed to dislodge Gaddafi. The African Union said the only way forward was a ceasefire and negotiated peace. London joined Paris in suggesting that while Gaddafi must step down, perhaps he could stay in Libya.
But hidden away from view, the plan to seize Tripoli was moving into action.
The rebels began making swift advances in the Western Mountains, out of Misrata and around the town of Zintan. Newly arrived Apache attack helicopters operating from Britain's HMS Ocean, an amphibious assault ship, were destroying armoured vehicles. NATO aircraft dropped leaflets to dispirit Gaddafi forces and improve rebel morale.
"The game-changer has been the attack helicopters which have given the NTC more protection from Gaddafi's heavy weapons," a French Defence Ministry official said.
The rebels' foreign backers were eager to hasten the war. For one thing, a U. N. mandate for bombing ran only to the end of September; agreement on an extension was not guaranteed. One U.S. official, speaking on condition of anonymity, told Reuters the main U.S. concern was "breaking the rough stalemate before the end of the NATO mandate".
The Europeans were also burning through costly munitions and Washington was concerned about wear and tear on NATO allies' aircraft. "Some of the countries... basically every deployable F-16 they had in the inventory was deployed," a senior U.S. defence official told Reuters.
But the momentum was shifting in the rebels' favour.
On July 28, the assassination of rebel military commander Abdel Fatah Younes proved a surprise turning-point. The former Interior Minister had defected to the rebels in February. Some believe he had held back their advance from the east, for reasons that remain unclear. Younes' death at the hands of his own men raised questions about the NTC and added impetus to NATO's desire to push things along in case the anti-Gaddafi forces imploded.
The West forced NTC head Mahmoud Jibril to change his cabinet. NATO then took more of the lead in preparations, according to Denece, who said he has contacts within both French and Libyan intelligence.
There was another boon to the rebels. Regional heavyweight Turkey came out in support of the NTC in July, and then held a conference at which 30 countries backed them. "The Turks actually were very helpful throughout this in a very quiet kind of way," said the senior U.S. defence official.
With the morale of Gaddafi troops eroding, the end was clearly near. Mediocre at the best of times, Gaddafi's fighters began fading away. So too did his secret weapon: foreign mercenaries.
After the uprising began, Gaddafi recruited several thousand mercenaries; some formed the core of his best-organised forces. Most of the hired guns came from countries to Libya's south such as Chad, Mali, and Niger, but some were from further afield, including South Africa and the Balkans.
Among them was a former Bosnian Serb fighter who had fought in Sierra Leone as a mercenary and later worked as a contractor in Afghanistan and Iraq. Hired in March, first as an instructor and later as the commander of a 120mm mortar battery, the fighter, who used his nom-de-guerre Crni ("the Black" in Serbian), told Reuters he had been paid regularly in cash in the western currency of his choice.
"I knew Libyans had poor discipline, but what I have seen was dismal in comparison with what we had in former Yugoslavia during our wars," he told Reuters. "They were cowards, at least many of them. Communications were the biggest problem, as they just couldn't figure out how to operate anything more sophisticated than a walkie-talkie, so we resorted to cellphones, when they worked and while they worked."
It was in early August, he said, that "everything started falling apart." The force of which he was a part began retreating from a rebel onslaught. "At some point we came under fire from a very organised group, and I suspect they were infiltrated (by) NATO ground troops," he said. The loyalist units pulled back to a point about 50 km (30 miles) from Tripoli. By mid-August, "I decided it was enough. I took a jeep with plenty of fuel and water and another two Libyans I trusted, and we travelled across the desert to a neighbouring country. It took us four days to get there."
A DRONE DEBATE
Foreign agents, meanwhile, were circulating far and wide. At the Tunisia-Libya border in early August, a Reuters reporter ran into a Libyan with an American accent who identified himself as the head of the rebel command centre in the Western Mountains. He was accompanied by two muscular blond western men. He said he spent a lot of time in the United States and Canada, but would not elaborate.
As the rebels advanced on Zawiyah, the Reuters reporter also saw western-looking men inside the Western Mountain region travelling in simple, old pickup trucks. Not far away, rebels in Nalut said they were being aided by CIA agents, though this was impossible to verify.
Operation Dawn Mermaid was initially meant to begin on Aug. 10, according to Mohammed Gula, the political cell leader in central Tripoli. But "other cities were not yet ready", the leadership decided, and it was put off for a few days.
A debate flared inside the Pentagon about whether to send extra Predator drones to Libya. "It was a controversial issue even as to whether it made sense to pull (drones) from other places to boost this up to try to bring this to a quicker conclusion," the U.S. defence official said.
Those who backed the use of extra drones won, and the last two Predators were taken from a training base in the United States and sent to north Africa, arriving on Aug. 16.
In the meantime, the rebels had captured several cities. By Aug. 17 or 18, recalls Gula, "when we heard that Zawiyah had fallen, and Zlitan looked like it was about to fall, and Garyan had fallen, we decided now is the time."
Those successes had a knock-on effect, U.S. and NATO officials told Reuters. With much of the country now conquered, Predator drones and other surveillance and strike planes could finally be focused on the capital. Data released by the Pentagon showed a substantial increase in the pace of U.S. air strikes in Libya between Aug. 10 and Aug. 22.
"We didn't have to scan the entire country any longer," a NATO official said. "We were able to focus on where the concentrations of regime forces were."
Days before the attack on Tripoli, the White House began leaking stories to TV networks saying Gaddafi was near the end. But U.S. intelligence officials -- who are supposed to give an objective view of the situation on the ground -- were pushing back, telling journalists they were not so sure of immediate victory and the fighting could go on for months.
Then, on Aug. 19, a breakthrough: Abdel Salam Jalloud, one of the most public faces of Gaddafi's regime, defected. Jalloud had been trying to get out for the previous three months, according to the senior NTC official. "He asked for our help but because he wanted his whole family, not only his immediate one, to flee with him it was a logistical problem. His whole family was around 35."
By now, the mountain roads were under rebel control. They took him and his family from Tripoli to Zintan and across the border into Tunisia. From there, he flew to Italy and on to Qatar.
The rebel leadership was ready. But now NATO wanted more time. "Once they got control of Zawiyah, we were sort of expecting that they would make a strategic pause, regroup and then make the push on into Tripoli," the senior U.S. defence official said.
"We told NATO we're going to go anyway," said a senior NTC official.
The western alliance quickly scaled back its number of bombing targets to 32 from 82, while rebel special forces hit some of the control rooms that were not visible, like those in schools and hospitals.
The signal to attack came soon after sunset on Aug. 20, in a speech by NTC Chairman Mustafa Abdel Jalil. "The noose is tightening," he said. A "veritable bloodbath" was about to occur.
Within 10 minutes of his speech, rebel cells in neighbourhoods across Tripoli started moving. Some units were directly linked to the operation; many others were not but had learned about the plan.
"We didn't choose it, the circumstances and the operations led us to this date," Alhasi told Reuters when asked why the uprising in Tripoli began then. "There was a public plan in Tripoli that they would rise up on that day, by calling from the mosques. It was not a military plan, not an official plan, it was a people's plan. The people inside Tripoli, they did this in coordination with us."
In the first few hours, rebel cells attacked installations and command posts. Others simply secured neighbourhoods, setting up roadblocks and impeding movement.
Ships laden with food and ammunition set off from rebel-held Misrata. Rebel forces began pushing towards the capital from the Western Mountains and from the east. According to French newspapers, NATO cleared a path on the water by destroying pro-Gaddafi speed boats equipped with explosives.
The first rebel soldiers reached the city within a few hours. The rag-tag army didn't look like much: some warriors wore football kit bearing the name of English soccer players. But they encountered little resistance.
One rebel source said Gaddafi had made a fatal error by sending his important brigades and military leaders, including his son Mu'atassem, to secure the oil town of Brega. The Libyan leader apparently feared the loss of the oil area would empower the rebels. But it meant he left Tripoli without strong defences, allowing the rebels easy entry.
The air war was also overwhelming the regime. Under attack, Gaddafi forces brought whatever heavy equipment they still had out of hiding. In the final 24 hours, a western military official said, NATO "could see remnants of Gaddafi forces trying to reconstitute weapons systems, specifically surface-to-air missiles". NATO pounded with them with air strikes.
By Sunday Aug. 21, the rebels controlled large parts of Tripoli. In the confusion, the NTC announced it had captured Saif al-Islam. Late the following evening, though, he turned up at the Rixos, the Tripoli hotel where foreign reporters were staying. "I am here to disperse the rumours...," he declared.
U.S. and European officials now say they believe Saif was never in custody. NTC chief Mahmoud Jibril attributes the fiasco to conflicting reports within the rebel forces. But, he says, the bumbling turned into a bonanza: "The news of his arrest gave us political gains. Some countries recognised us, some brigades surrendered ... and more than 30 officers defected."
As the Gaddafi brigades collapsed, the rebels reached a sympathiser in the Libyan military who patched them into the radio communications of Gaddafi's forces. "We could hear the panic through their orders," said the senior NTC official. "That was the first indication that our youths were in control of Tripoli."
As the hunt for Gaddafi got underway, the NTC began implementing a 70-page plan, drawn up in consultation with its foreign military backers, aimed at establishing security in the capital.
Officials in London, Paris and Washington are at pains to say the plan is not based on the experience of Iraq or any other country, but the lessons of their mistakes in Baghdad are obvious.
At a press conference in Qatar, NTC head Jibril said Libya would "rehabilitate and cure our wounds by being united so we can rebuild the nation."
Unity was not hard to find during the uprising. "The most important factor was the will of the people," commander Alhasi told Reuters. "The people hate Gaddafi."
Will Libya remain united once he's gone?
(With reporting by Robert Birsel in Benghazi, Peter Graff in Tripoli, Michael Georgy in the Western Mountains, Phil Stewart and Mark Hosenball in Washington, Regan Doherty in Doha, Bill Maclean and Peter Apps in London, John Irish in Paris, Nick Carey in Chicago, Aleksander Vasovic in Belgrade and Justyna Pawlak in Brussels; editing by Simon Robinson, Mike Williams and Sara Ledwith)