“I was informed about the demise of the former president of the friendly country, South Africa, his eminence Nelson Mandela to my great sorrow and deep grief,” the Iranian president wrote in a message to President Jacob Zuma on Friday.
Mandela, South Africa's first black president and anti-apartheid icon died at the age of 95 on Thursday, the President Zuma said on Thursday.
In a statement on South African national TV, President Zuma said that Mandela died "peacefully" and surrounded by his family at his Johannesburg home on Thursday evening.
"This is our moment of deepest sorrow, our nation has lost its greatest son," said Zuma, describing the anti-apartheid icon as a "father" to the nation. South Africans would "mourn the one person who, more than any other, came to embody their sense of common nationhood", Voice of Russia reported.
"What made Nelson Mandela great was precisely what made him human. We saw in him what we seek in ourselves," Zuma said.
"Fellow South Africans, Nelson Mandela brought us together and it is together that we will bid him farewell."
Mandela led South Africa's transition from white-minority rule in the 1990s, after 27 years in prison.
He had been receiving intense home-based medical care for a lung infection after three months in hospital.
All flags in South Africa will fly half-mast until after the state funeral of Mandela.
Over the course of his life, anti-apartheid icon Nelson Mandela provided many memorable speeches and soundbites.
In the dock at the 1964 Rivonia Trial facing the gallows for acts of sabotage against the apartheid government, he told the court, "I have fought against white domination, and I have fought against black domination. I have cherished the ideal of a democratic and free society in which all persons live together in harmony and with equal opportunities. It is an ideal which I hope to live for and to achieve. But if needs be, it is an ideal for which I am prepared to die."
UN Secretary-General Ban Ki-moon sent his deepest condolences to Nelson Mandela's family and the people of South Africa Thursday calling Mandela "a giant for justice and a down-to-earth human inspiration."