This file photo from 1994 shows Nelson Mandela.

Former president Nelson Mandela has died.

Mandela died peacefully at his home in Johannesburg, surrounded by his family on Thursday evening, President Jacob Zuma said.

"Although we knew that this day would come, nothing can diminish our sense of a profound and enduring loss," Zuma said addressing the nation on television.

"His tireless struggle for freedom earned him the respect of the world."

He sent condolences to the anti-apartheid icon's wife Graca Machel, his former wife Winnie Madikizela-Mandela, his children, his grand-children, his great grand-children and the entire family.

Zuma said this was South Africa's moment of "deepest sorrow".

"Our nation has lost its greatest son," he said.

"Fellow South Africans, Nelson Mandela brought us together, and it is together that we will bid him farewell."

He said Mandela would be given a state funeral and he ordered that all flags be flown at half mast from Friday and to remain like that until after the funeral.

"As we gather to pay our last respects, let us conduct ourselves with the dignity and respect that Madiba personified," Zuma said.

"Let us be mindful of his wishes and the wishes of his family."

He asked that people, wherever they were gathering in South Africa and the world, recall the values which Mandela fought for and strive to not rest until his vision of a truly united South Africa was realised.

"We will always love you Madiba. May your soul rest in peace.

"God Bless Africa. Nkosi Sikelel' iAfrika."

Sapa