For months, US spies had been monitoring Venezuelan President Nicolas Maduro's every move.

A small team, including one source within the Venezuelan government, had been observing where the 63-year-old slept, what he ate, what he wore and even, according to top military officials, 'his pets'.

Then, in early December, a planned mission dubbed Operation Absolute Resolve was finalized. It was the result of months of meticulous planning and rehearsals, which even included elite US troops creating an exact full-size replica of Maduro's Caracas safe house to practice their entry routes.

The plan - which amounted to an extraordinary US military intervention in Latin America not seen since the Cold War - was closely guarded. Congress was not informed or consulted ahead of time. With the precise details set, top military officials simply had to wait for the optimal conditions to launch.

They wanted to maximize the element of surprise, officials said on Saturday. There was a false start four days earlier when US President Donald Trump gave approval, but they opted to wait for better weather and less cloud cover.

Over the weeks through Christmas and New Year, the men and women of the United States military sat ready, patiently waiting for the right triggers to be met and the president to order us into action, General Dan Caine, the nation's highest-ranking military officer, told a news conference on Saturday morning.

The order from the president to begin the mission finally came at 22:46 EST on Friday (03:46 GMT on Saturday).

We were going to do this four days ago, three days ago, two days ago, and then all of a sudden it opened up. And we said: go, Trump himself told Fox & Friends on Saturday, hours after the overnight raid.

He said to us, and we appreciate it... good luck and godspeed, Gen Caine said. Trump's order came shortly before midnight in Caracas, giving the military most of the night to operate in darkness.

What followed was a two-hour-and-twenty-minute mission by air, land, and sea that stunned many in Washington and around the world.

In terms of scale and precision, it was virtually unprecedented. And it drew immediate condemnation from several regional powers, with Brazil's President Lula da Silva saying the violent capture of Venezuela's leader set yet another extremely dangerous precedent for the entire international community.

Trump did not follow the mission from the White House situation room. Instead, he was surrounded by his advisers at his Mar-a-Lago club in Palm Beach, Florida, where he watched a live stream of the operation flanked by CIA Director John Ratcliffe and US Secretary of State Marco Rubio.

It was an incredible thing to see, Trump said on Saturday. If you would have seen what happened, I mean, I watched it literally like I was watching a television show. And if you would've seen the speed, the violence... it's just, it was an amazing thing, an amazing job that these people did.

In recent months, thousands of US troops have deployed to the region, joining an aircraft carrier and dozens of warships in the largest military build-up in decades as Trump has accused Maduro of drug-trafficking and narco-terrorism, and blown up dozens of small boats accused of ferrying drugs through the region.

But the first signs of Operation Absolute Resolve were in the skies. More than 150 aircraft - including bombers, fighter jets, and reconnaissance planes - were ultimately deployed through the course of the night, according to US officials.

It was very complex, extremely complex, the whole maneuver, the landings, the number of aircraft, Trump told Fox News. We had a fighter jet for every possible situation.

Loud explosions were heard in Caracas at about 02:00 local time (06:00 GMT), and plumes of smoke were seen rising over the city. I heard a huge sound, a loud bang, reporter Ana Vanessa Herrero told the BBC. It moved all the windows. Immediately after I saw a huge cloud of smoke that almost blocked the entire view.

Soon, videos showing numerous aircraft in the skies - and others showing the apparent aftermath of explosions - began to circulate widely on social media. One showed a convoy of helicopters flying at low altitude over Caracas as smoke rose from apparent detonations.

As strikes rang out around Caracas, US forces made their way into the city. They included members of the elite Delta Force, the US military's top special mission unit, sources told the BBC's US news partner CBS. They were heavily armed - and carried a blowtorch in case they had to cut through the metal doors of Maduro's safe house.

In Maduro's compound, as elite US troops flooded in, Trump said the Venezuelan president - who has reportedly increased his reliance on Cuban bodyguards in recent months - attempted to flee to a safe room.

He was trying to get to a safe place, which wasn't safe, because we would have had the door blown up in about 47 seconds, Trump said.

When asked if the US could have killed Maduro, an authoritarian leader who took over the presidency in 2013, if he had resisted arrest, Trump said: It could have happened.

On the US side, a couple of guys were hit, he said, but no US service members were killed. The Venezuelan authorities have not confirmed any casualties.

The US had previously offered a $50m reward for information leading to Maduro's arrest. But by 04:20 local time on Saturday, helicopters were leaving Venezuelan territory with Maduro and his wife on board, in custody of the US Department of Justice and en route ultimately to New York, where they are expected to face criminal charges.

Almost exactly an hour later, Trump announced the news of his capture to the world. Maduro and his wife will soon face the full might of American justice, he said.