Nelson Mandela spent 27 years in prison, most of them isolated on Robben Island off the coast of Cape Town, South Africa. His encounters with visitors from the outside world were brief and strictly controlled; he spent much of his time alone, uncertain of whether he would ever emerge alive.

But a new collection of Mandela’s letters from prison shows how the freedom fighter who would become South Africa’s first black president kept himself grounded and connected to the outside world, even as apartheid leaders tried to silence him. “The Prison Letters of Nelson Mandela,” edited by South African journalist Sahm Venter, was released this month and features 255 letters from Mandela — about half of which have never been seen publicly before.

Venter, who spent nearly a decade reviewing the letters, said in an email to The Washington Post that the wisdom Mandela displayed is “particularly relevant in the world today, which is experiencing the rise of ... racism, sexism and xenophobia.”

The book reveals the personal side of South Africa’s most famous man — a side Mandela was reluctant to share publicly after his imprisonment and before the publication of his memoir, “Long Walk to Freedom.” While in prison, Mandela missed raising his children and burying both his mother and elder son, Thembi, who was killed in a car accident in 1969. His correspondence brings to light the efforts he made to humanize himself to prison officials as he requested special permission to attend family funerals — requests that were denied. They also offer a lens into the pain Mandela experienced in remaining isolated as he grieved for his loved ones.

“The feeling of anguish & depression that had hit me so viciously when I received the horrible news of his death returned and began to gnaw away mercilessly at my insides,” he wrote to his wife, Winnie, after a visit from Thoko Mandela, his son Thembi’s young widow.

Letters to his children also reveal how Mandela tried to be an active father from prison — often coming up short. While his daughters were young when he was arrested, Mandela addressed his family’s difficulties head-on and did not shy away from explaining where he was and what his incarceration meant. His letters to various family friends expressed concern over how the children were faring, especially after the arrest of Winnie in 1969.

The words Mandela sent to his family reveal remarkable patience and positivity. But Venter said one of her most unexpected discoveries was finding “detailed letters to the prison authorities in which he complained about conditions in prison.”

In 1970, Mandela asked the commanding officer to reconsider his refusal to provide him with four pounds of honey each month, which Mandela claimed he needed for medical purposes. In another he requested Pond’s Cold Cream for his dry skin, complaining that he was instead given Vaseline. Many of his letters to prison officials included requests for new study materials — he was pursuing a law degree from his cell. One lengthy letter from 1976 describes how he has “slept naked on a cement floor that becomes damp and cold during the rainy season” for 13 years and urgently needs pajamas, noting that white prisoners have always been provided pajamas and only black prisoners have not.

“He was not allowed to write about prison conditions or other prisoners in his letters to family and friends,” Venter said. “So it is through these letters that we can today learn of exactly what it was like for him and his comrades in prison.”