JOHANNESBURG – South Africans have gathered in Johannesburg and Soweto to mourn their former leader, Nelson Mandela, who died on Thursday aged 95.
Crowds paid tribute, dancing and singing in front of Mr Mandela's former home in Soweto throughout the night.
Flags flew at half mast after President Jacob Zuma announced his death in a late night national TV address.
Mr Mandela spent 27 years in jail before becoming South Africa's first black president in 1994.
His administration replaced the racist white-minority regime that had enforced segregation of black and white people in a policy known as apartheid.
Scenes from around the globe in the hours after Nelson Mandela's death as world leaders, South Africans, and our own journalists react
Mr Mandela went on to become one of the world's most respected statesmen.
A service of national mourning will be held at a 95,000-seater stadium on the outskirts of Johannesburg. His body will then lie in state for three days in the capital, Pretoria, before being taken for a state funeral in the village of Qunu in the Eastern Cape, where he grew up.
"God was so good to us in South Africa by giving us Nelson Mandela to be our president at a crucial moment in our history," said long-time ally Archbishop Emeritus Desmond Tutu.
1918 Born in the Eastern Cape
1943 Joins ANC
1956 Charged with high treason, but charges dropped after a four-year trial
1962 Jailed for five years for incitement and leaving country without a passport
1964 Charged with sabotage, sentenced to life
1990 Freed from prison
1993 Wins Nobel Peace Prize
1994-99 Serves as president
2004 Retires from public life
2005 Announces his son has died of an HIV/Aids-related illness
At a service in Cape Town on Friday, he said Mr Mandela had "taught a divided nation to come together".
Mr Mandela had been suffering from a lung illness for a long time.
He had been receiving treatment at home since September, when he was discharged from hospital.
As soon as the news broke, small crowds began to gather in Soweto's Vilakazi Street, where Mr Mandela lived in the 1940s and 1950s.
Crowds chanted apartheid-era songs, including one with the lyrics: "We have not seen Mandela in the place where he is, in the place where he is kept."
The announcement of Mandela's death was made by President Jacob Zuma
By daybreak, dozens more had gathered.
"We are celebrating his life and all that he did for us," said one of the mourners, Terry Mokoena.
Crowds also gathered outside Mr Mandela's current home, in Johannesburg's northern suburb of Houghton, where he died.
Across the world, leaders, celebrities and members of the public have been paying tribute.
"He achieved more than could be expected of any man. Today, he has gone home," said US President Barack Obama.
When Africans mourn, they do it through song, dance and music. So as South Africans awoke to news of Nelson Mandela's death, crowds had begun gathering outside his homes in Houghton and Soweto.
They are mourning him through songs of struggle and church hymns. One of the songs is "Nelson Mandela ha hona ea tshwanang le yena" which in Sotho means there is no-one like Nelson Mandela. This song and many others like it encapsulate the deep sense of loss here and the realisation that his passing marks the end of an era.
Even South Africans who had never met him had made a special place for him in their hearts. They will remember him as the father of the nation, who brought an end to apartheid and delivered the nation from the brink of civil war.
The mood is a combination of sombreness and reflection. His passing has brought unity amongst South Africans as black and white speak of their love for him. Many here will be drawing on that same spirit for strength, that "Madiba magic" over the next few days and weeks.
UN Secretary General Ban Ki-moon called him "a giant for justice and a down-to-earth human inspiration".
Flags are flying at half-mast on government buildings in Washington DC, Paris and across South Africa.
Books of condolence will be opened at public buildings in South Africa and at the country's embassies throughout the world.
Next Monday is expected to be the start of South Africa's official mourning, with a service in Soweto's FNB stadium.
Mr Mandela's body will lie in state for three days at the Union buildings in Pretoria before a funeral is held on Saturday in Qunu, the village in Eastern Cape where he was born.
The BBC's Mike Wooldridge in Johannesburg says South Africa will never have seen a state funeral like it, with leaders, dignitaries and other admirers of the former president expected from all over the world.
It will be a huge logistical challenge, especially given the remoteness of Qunu, our correspondent adds.
In his TV address, Mr Zuma said Mr Mandela had died shortly before 21:00 local time (19:00 GMT).
"Our nation has lost its greatest son," Mr Zuma said.
"Although we knew that this day would come, nothing can diminish our sense of a profound and enduring loss."
Mr Mandela won admiration around the world when he preached reconciliation after being freed from almost three decades of imprisonment.
He was awarded the Nobel Peace Prize in 1993 along with FW de Klerk, South Africa's last white president.
Mr de Klerk, who ordered Mr Mandela's release from jail, called him a "unifier" and said he had "a remarkable lack of bitterness".
He told the BBC that Mr Mandela's greatest legacy was that "we are basically at peace with each other notwithstanding our great diversity, that we will be taking hands once again now around his death and around our common sadness and mourning".