South African security forces have had only days to implement a rough plan for Nelson Mandela's grand funeral, based partly on blueprints of past major events like the 2010 World Cup final.
South Africa's first black president had been seriously ill for some time, but his death still posed a major challenge as a small army of world leaders, dignitaries and celebrities asked to attend the state send-off.
Security preparations which would normally take months for the likes of US President Barack Obama had to be compressed into a few days.
There is also the issue of hundreds of thousands of South Africans who want to say a final farewell to the man who led them out of the apartheid era, so the security authorities have largely relied on the experience they gained during the World Cup nearly four years ago.
About 80,000 people will attend a memorial service Tuesday at the Soweto stadium that hosted the 2010 final.
Mandela's body will then lie in state for three days in Pretoria before being taken for burial Sunday in his rural boyhood home of Qunu.
Areas around all three venues will be subjected to different levels of security lockdown, with flight restrictions in force around Mthatha, the nearest airport to Qunu.
Analyst Johan Burger from the Institute for Security Studies in Pretoria, said a basic security blueprint had existed for some time.
"Now they have to fill in the numbers and the names and allocate the tasks to the specific commanders," Burger said.
Many of the more than 90 world leaders attending the various events will bring their own security teams, said Solomon Makgale, spokesman for the National Joint Operational Centre (Natjoints), which co-ordinates between the police, military and intelligence agencies.
"All of them always come with their security detail, then they work with us," he said.
Security forces' leave has been cancelled until after Sunday's burial and about 11,000 soldiers have been deployed to back up police operations.
Some 3,000 marshalls will be engaged in crowd control at the Soweto stadium, which will be surrounded by three concentric security circles of increasing scrutiny, with vehicle access severely restricted.
The same system will apply for Mandela's lying in state at the Union Buildings, the seat of government in Pretoria where he was inaugurated 19 years
The government has sought to discourage foreign leaders from attending the burial in Qunu, citing its rural location, lack of amenities and limited space.