Cuba's president, Raúl Castro, will join Barack Obama and South Africa's president, Jacob Zuma, among the speakers paying tribute to Nelson Mandela on Tuesday at what has been described as the biggest funeral in history.

The memorial service in Johannesburg, in effect the first leg of a funeral that culminates with Mandela's burial on Sunday, will also include interfaith prayers, eulogies by four of Mandela's grandchildren and speeches by the presidents of Brazil, Namibia, India and Cuba, along with the vice-president of China. Zuma will deliver the keynote address.

For dignitaries attending the service, not least Obama and Castro, a potential diplomatic minefield awaits. But Zelda la Grange, Mandela's personal assistant for more than a decade, told Reuters: "Tomorrow, people should all be honouring their relationship with Madiba. If it means shaking hands with the enemy, yes, I would like to see that. That is what Nelson Mandela was and actually is – bringing people together despite their differences."

The cover of the official memorial programme bears the title "State memorial service for the late former president Nelson Rolihlahla Mandela" above a picture of South Africa's first black president smiling and wearing a characteristically flamboyant shirt. Inside the programme is an obituary over two pages that concludes: "Mr Mandela is survived by his wife, Graca, three daughters, 18 grandchildren and 12 great-grandchildren."

Obama and his wife, Michelle, will be joined by the former presidents Jimmy Carter, Bill Clinton and George W Bush. Also attending are David Cameron, Ban Ki-moon, assorted princes and princesses, and celebrities including Bono, Oprah Winfrey and the Spice Girls. Mandela dubbed the last his "heroes" after meeting the pop group 16 years ago.

Clayson Monyela, South Africa's head of public diplomacy, tweeted: "Pope John Paul's funeral brought together 70 heads of state & 14 leaders of other regions. With #Mandela we're already over 91 & counting."

On Monday workers were inside the 95,000-capacity FNB stadium welding scaffolding for a stage and installing bulletproof glass to protect foreign leaders. Ground crews cut the grass in front of the venue, dubbed the "calabash" because of its shape. The stadium, where Mandela made his last public appearance, at the closing ceremony of the 2010 football World Cup, is expected to fill rapidly on Tuesday, posing a huge security and logistical challenge for South African authorities.

All police leave has been cancelled and thousands of officers called up to direct traffic, protect mourners and help the bodyguards of visiting dignitaries.

Government minister Collins Chabane said officials could not guess how many people would attend or would try to enter the stadium. "Once we see that the numbers are becoming unmanageable … access will be denied," he said.

Chabane appealed to those who were turned away to "respond with decency", pointing out that spillover venues with big screens had been set up.

The government will be seeking to avoid a repeat of the disarray around last year's centenary celebrations of the African National Congress (ANC). African leaders were reportedly forced to go shopping when they found no food or bedding at their accommodation. Uganda's president, Yoweri Museveni, apparently had to send for some grilled chicken from Nando's.

Chabane said 91 heads of state and government had confirmed their attendance by noon on Monday but dismissed predictions that officials would be overwhelmed. "For those who predict there will be chaos, we're used to it. It's not new."

Soon after the end of racial apartheid, Collins noted, South Africa had hosted the rugby World Cup, football's Africa Cup of Nations and numerous other showpiece events. "People said there would be chaos. It didn't happen."

He added: "Our people, our supporters are with us to make sure this is a success. We'll prove them [the doubters] wrong."

A joint taskforce of police, diplomats and intelligence service personnel has been in talks with the foreign delegations who plan to attend the ceremony, due to start at 11am and finish at 3pm.

Both Obama and Cameron are understood to be arriving on Tuesday morning. Of the US presidents attending, only Clinton, who was close to Mandela, is thought to be staying long enough to attend Sunday's burial in Qunu, in Eastern Cape province. Cameron will not be present there but Prince Charles will attend.

The clamour to honour Mandela looks set to potentially eclipse the funerals of Winston Churchill, Diana, Princess of Wales, John F Kennedy and Pope John Paul – a big organisational ask for any country. Brooks Spector, a Johannesburg-based former US diplomat, said: "Apart from the UN, this looks like the biggest gathering of heads of state there has ever been. It's a rare event that gets the sitting US president and three ex-presidents together except an inauguration. The South African government was preparing in many ways but the tidal wave might have surprised even those preparing."

Asked whether South Africa can cope, Spector replied: "It'll work because it has to work. They won't leave a king on the side of a highway trying to thumb a lift to the FNB Stadium. When they put their minds to it and national honour is at stake, they pull it off. Clearly national honour is at stake on this one.

"This is a shared national moment. It's going to be unique in this nation's history. There's a lot of goodwill and a lot of energy directed towards getting it right."

Mandela's body will lie in state in the capital, Pretoria, on Wednesday, Thursday and Friday before being flown to Qunu, the village where he grew up. Officials said his burial ceremony would run from 9am to noon on Sunday, with the guest list not exceeding 5,000 people.

No heads of state would be turned away, they added, but they have generally been discouraged from attending because of the daunting logistics in the remote rural area. More than 1,500 journalists have been accredited for the events.

Across the country on Monday, South Africans continued to celebrate the life of the anti-apartheid hero. Just after dawn a two-mile-long motorcade of cars full of ANC supporters left Cape Town for the former Victor Verster prison, the last jail where Mandela was held and where, emerging alongside his former wife Winnie with his fist raised triumphantly, he marked his transformation from revolutionary fighter to elder statesman.

Inside the on-site house, a candle burned on the table where a historic settlement was reached between Mandela and the then president, FW de Klerk. "I'm feeling emotional, sad, but also honoured to have been alive during his lifetime," said Jo-Anne Aranes, a cleaner whose car was plastered in the green, gold and black of the ANC flag. Her 10-year-old daughter had accompanied her. "It's extra-special to me because my daughter is here to learn our history," she said.