Nelson Mandela, the icon of South Africa's anti-apartheid struggle and a colossus of 20th century politics, died late on Thursday aged 95, prompting mass mourning and a global celebration of his astonishing life.
The Nobel Peace laureate, who was elected South Africa's first black president after spending nearly three decades in jail, died at his Johannesburg home surrounded by his family, after a long battle against lung infection.
The news was announced to the nation and the world by an emotional South African President Jacob Zuma, in a live late-night broadcast.
"Our beloved Nelson Rolihlahla Mandela, the founding president of our democratic nation, has departed," said Zuma, whose own role in the struggle against white rule saw him imprisoned with Mandela on Robben Island.
"Our nation has lost its greatest son. Our people have lost a father."
As the sun came up on Friday, hundreds of South Africans maintained an impromptu vigil outside the Mandela home in Johannesburg, ululating, waving flags and singing anti-apartheid era songs.
"I did not come hear to mourn. We are celebrating the life of a great man. A great unifier," said Bobby Damon, who lives just a few streets away from Mandela's house.
"But I must admit though, the news came as a shock" he added. "There will never be another Mandela in our lifetime."
Zuma announced Mandela will receive a full state funeral and he ordered flags to remain at half-mast until after the burial. National flags were also lowered in countries including the United States and France.
State broadcaster SABC later said Mandela's body had been moved to a military hospital in Pretoria.
Barack Obama, America's first black president, paid tribute to a man who "took history in his hands and bent the arc of the moral universe towards justice".
Obama was joined in mourning by a roll call of figures from across the worlds of politics, business and sport, reflecting how much Mandela had touched hearts as a rallying point for justice and good causes after he drew a "Rainbow Nation" out of his diverse homeland.
His death had long been expected, coming after a spate of hospitalisations with lung infections and three months of intensive care at home. But the announcement came as a shock nonetheless.
Mandela's two youngest daughters were in London watching the premiere of his biopic "Long Walk to Freedom" when they were told of his death.
Archbishop emeritus Desmond Tutu lauded his fellow Nobel laureate as the man who taught a deeply divided nation how to come together. "To suggest that South Africa might go up in flames -- as some have predicted -- is to discredit South Africans and Madiba's legacy," Tutu said in a statement. "The sun will rise tomorrow... It may not appear as bright as yesterday, but life will carry on."
'Terrorist' turned icon
Once considered a terrorist by the United States and Britain for his support of violence against the apartheid regime, at the time of his death he was an almost unimpeachable moral icon.
Mandela's extraordinary life story, quirky sense of humour and lack of bitterness towards his former oppressors ensured global appeal for the charismatic leader.
He spent 27 years behind bars before being freed in 1990 to lead the African National Congress (ANC) in negotiations with the white minority rulers which culminated in the first multi-racial elections in 1994.
A victorious Mandela served a single term as president before taking up a new role as a roving elder statesman and leading AIDS campaigner before finally retiring from public life in 2004. Key dates in the life of anti-apartheid hero Nelson Mandela
The man he replaced, South Africa's last white president FW de Klerk, also paid tribute.
"South Africa has lost one of its founding fathers and one of its greatest sons," he said. Born in July 1918 in the southeastern Transkei region, Mandela started a career as a lawyer in Johannesburg in parallel with his political activism.
He became commander-in-chief of Umkhonto we Sizwe (Spear of the Nation), the armed wing of the by now-banned ANC, in 1961, and the following year underwent military training in Algeria and Ethiopia.
While underground back home in South Africa, Mandela was captured by police in 1962 and sentenced to five years in prison.
He was then charged with sabotage and sentenced in 1964 to life in prison at the Rivonia trial, named after a Johannesburg suburb where a number of ANC leaders were arrested.
He used the court hearing to deliver a speech that was to become the manifesto of the anti-apartheid movement.
"During my lifetime, I have dedicated myself to this struggle of the African people. I have fought against white domination and I have fought against black domination. I have cherished the ideal of a democratic and free society.
"It is an ideal for which I am prepared to die." He was first sent to prison on Robben Island, where he spent 18 years before being transferred in 1982 to Pollsmoor prison in Cape Town and later to Victor Verster prison in nearby Paarl.
When he was finally released on February 11, 1990, he walked out of prison with his fist raised alongside his then-wife Winnie.
Ex-prisoner 46664 took on the task of persuading de Klerk to call time on the era of racist white minority rule. Mandela and de Klerk were jointly awarded the Nobel Peace Prize in 1993 for their role in the ending of apartheid.
'We'd like to be him'
After the ANC won the first multi-racial elections, Mandela went out of his way to assuage the fears of the white minority, declaring his intention to establish "a rainbow nation at peace with itself and the world".
Critics said his five-year presidency was marred by corruption and rising levels of crime. But his successors, Thabo Mbeki and Jacob Zuma, have never enjoyed anywhere near the same levels of respect or affection.
His divorce from second wife Winnie was finalised in 1996.
He found new love in retirement with Graca Machel, the widow of the late Mozambican president Samora Machel, whom he married on his 80th birthday.
In one of his last foreign policy interventions, he issued a searing rebuke of George W Bush on the eve of the US invasion of Iraq in 2003, calling him "a president who has no foresight, who cannot think properly, is now wanting to plunge the world into a holocaust".
Bush's predecessor as US president, Bill Clinton, had a higher opinion of Mandela.
"Every time Nelson Mandela walks in a room we all feel a little bigger, we all want to stand up, we all want to cheer, because we'd like to be him on our best day," he said.
Myanmar's own democracy icon Aung San Suu Kyi spoke of her "extreme grief" at the death of her fellow Nobel Peace laureate, who she said had "made us understand that we can change the world".
Mandela is survived by three daughters, 18 grandchildren, nine great-grandchildren and three step-grandchildren. He had four step-children through his marriage to Machel.
His death has left his family divided over his wealth. Some of his children and grandchildren are locked in a legal feud with his close friends over alleged irregularities in his two companies.