They called it Operation Mermaid Dawn, a stealth plan coordinated by sleeper cells, Libyan rebels, and NATO to snatch the capital from the Moammar Gadhafi's regime's hands.
It began three months ago when groups of young men left their homes in Tripoli and traveled to train in Benghazi with ex-military soldiers.
After training in Benghazi, the men would return to Tripoli either through the sea disguised as fishermen or through the western mountains.
"They went back to Tripoli and waited; they became sleeper cells," said military spokesman Fadlallah Haroun, who helped organize the operation.
He said that many of the trained fighters also stayed in the cities west of Tripoli, including Zintan and Zawiya, and waited for the day to come to push into the capital.
Operation Mermaid Dawn began on the night of August 21 and took the world by surprise as the rebels sped into the capital and celebrated in Green Square with almost no resistance from pro-Gadhafi forces.
Haroun said about 150 men rose up from inside Tripoli, blocking streets, engaging in armed street fights with Gadhafi brigades, and taking over their streets with check points.
He said another 200 men from Misrata.
But why did the armed Gadhafi troops melt away when the rebels drove through?
Fathi Baja, head of the rebel leadership's political committee, said it was all thanks to a deal cut with the head of the batallion in charge of protecting Tripoli's gates, the Mohammed Megrayef Brigade.
His name was Mohammed Eshkal and he was very close to Gadhafi and his family. Baja said Gadhafi had ordered the death of his cousin twenty years ago.
"Eshkal carried a grudge in his heart against Gadhafi for 20 years, and he made a deal with the NTC _ when the zero hour approached he would hand the city over to the rebels," said Haroun.
"Eshkal didn't care much about the revolution," said Haroun. "He wanted to take a personal revenge from Gadhafi and when he saw a chance that he will fall, he just let it happen."
But Haroun said he still didn't trust Eshkal or the men who defected so late in the game.
Haroun said that he didn't trust any of the defectors who left Gadhafi's side so close to August 20.
"They lived knew his days were numbered so they defected, but in their hearts they will always fear Gadhafi and give him a regard," he said.
Haroun said NATO was in contact with the rebel leadership in Benghazi and were aware of the date of Operation Mermaid Dawn.
"Honestly, NATO played a very big role in liberating Tripoli _ they bombed all the main locations that we couldn't handle with our light weapons," said Harouin.
Analysts have noted that as time went on, NATO airstrikes became more and more precise and there was less and less collateral damage, indicating the presence of air controllers on the battlefields.
Targeted bombings launched methodical strikes on Gadhafi's crucial communications facilities and weapons caches. An increasing number of American hunter-killer drones provided round-the-clock surveillance as the rebels advanced.
Diplomats acknowledge that covert teams from France, Britain and some East European states provided critical assistance.
The assistance included logisticians, security advisers and forward air controllers for the rebel army, as well as intelligence operatives, damage assessment analysts and other experts, according to a diplomat based at NATO's headquarters in Brussels. The diplomat spoke on condition of anonymity due to the sensitivity of the issue.
Foreign military advisers on the ground provided key real-time intelligence to the rebels, enabling them to maximize their limited firepower against the enemy. One U.S. official, speaking on condition of anonymity to discuss intelligence matters, said the Qatari military led the way, augmented later by French, Italian and British military advisers. This effort had a multiple purpose, not only assisting the rebels but monitoring their ranks and watching for any al-Qaida elements trying to infiltrate or influence the rebellion.
Bolstering the intelligence on the ground was an escalating surveillance and targeting campaign in the skies above. Armed U.S. Predator drones helped to clear a path for the rebels to advance.
Baja said as the time for Operation Mermaid Dawn came close to execution, NATO began to intensify their bombing campaign at Bab al-Azizya and near jails where weapons were stored and political prisoners were held.
And then the people rose up.
Al-Shalchi reported from Cairo.