Nelson Mandela’s letters from prison seem to demand a spoiler alert. We know how this epic turns out – but the uncanny thing about reading this selection of close-written correspondence is the unavoidable sense that its author always knew the ending in advance, too.

Mandela was born a century ago this week. The conviction that his story would make history, that it would have a triumphant last act of truth and reconciliation, hardly ever appears to have faltered within him. Not when the judge sentenced him to life imprisonment at the end of the Rivonia trial in 1964. Not when the door slammed behind him aged 45 as prisoner 466/64 in an 8ft by 7ft cell on Robben Island, his home for 18 years. Not even when, in 1969, his eldest son, Thembi, was killed in a car crash – a tragedy that followed less than a year after the death of Mandela’s mother – and he was refused permission to attend the funeral (just as he had been his mother’s).

In some ways, the ANC had anointed Mandela for that redemptive role back in the 60s, or at least the Xhosa tribal prince made himself the obvious leading man – tall, eloquent, charismatic, courageous. The inevitability of justice was the message of his bestselling autobiography, Long Walk to Freedom – and it is also the received wisdom of the various other retrospective tellings of the late 20th century’s most symbolic life, from the apocryphal account by his prison guard, James Gregory (which became the 2007 film Goodbye Bafana) to the latest two additions to the mythology: a brief and informative highlights package by the MP and anti-apartheid campaigner Peter Hain (Mandela: His Essential Life, Rowman and Littlefield, £16.99), and a memoir of a grandfather’s love and guidance by his grandson Ndaba (Going to the Mountain: Life Lessons from My Grandfather, Nelson Mandela, Hutchinson, £14.99).

The surprise of the 250 prison letters selected – half of them previously unpublished – is that despite all the hardship Mandela was suffering, that certainty of change already prevailed. Mandela wrote most of these long, thoughtful pages in the knowledge that few were reaching their intended recipients – his wife, Winnie, his children, or old friends and comrades. The family letters are invariably prefaced with disappointment that previous correspondence has gone unacknowledged – admonitions aimed more at the censor than at the addressee. Mandela, being Mandela, kept a log of all the many letters he sent, a record that the lawyer in him never forgot: “I sincerely don’t know,” he writes typically to Winnie at one point, “whether you’ll ever get this particular letter nor those of July 18, Aug 1 and 18 and, if you do, when that’ll be…”

Even in the knowledge that he was often writing into darkness, he kept up that most reasonable and patient of voices – rarely acknowledging anger, even less despair. The philosophy of “living in truth” is more readily associated with that other great prison correspondent Václav Havel, the sense that power lay in acting as far as possible as if the hated regime did not exist. Mandela clearly understood the force of that idea. In his letters he is at pains to inhabit his roles as father and husband and son and uncle and friend, just as surely as if he were a free man. That tone, which implied an otherworldly patience, no doubt spooked his prison warders as much as anything.

As Mandela emphasises from time to time, it would have been a mistake to confuse that tone with the reality of his life on Robben Island, a large part of which involved sitting in the prison yard smashing rocks to gravel with a hammer. The letters were not a reflection of that world, they were his escape from it. For the duration of the time in which his sentences carefully unspooled through their clauses he could forget about that other life sentence. In 1976, 14 years after he was first imprisoned, he suggested, again to his wife, that the hours in which he wrote “were the only time I ever feel that some day in the future it’ll be possible for humanity to produce saints who will really be inspired in everything they do by genuine love for humanity”. Mandela’s written rhetoric was so seductive, even he was in thrall to it.

In the midst of nearly 10,000 days of imprisonment he declared himself an early adopter of 'self -help' wisdom

A couple of times he mentions Saint Paul, another incarcerated hero, as an inspiration. “The advocate who prosecuted him,” Mandela notes with approval, “is reported to have said: ‘The plain truth is that we find this man a perfect pest; he stirs up trouble amongst the Jews the world over, and is ringleader of the Nazarene Sect.’” Mandela obviously liked the way that story turned out, but if he betrayed sustaining faith in anything, it was the liberating power of education, rather than any kind of religious suffering or political dogma. His letters home are full of inquiries about the children’s schooling; he sent a hopeful note to a bookseller in Johannesburg in 1971 asking for books to be sent to his kids for their birthdays – Upton Sinclair’s The Jungle, Hemingway’s For Whom the Bell Tolls, Steinbeck’s The Pearl – enclosing his five rand saving to cover the cost. The head warder scrawled a handwritten note across this letter: “This sort of thing is not allowed.”

Mandela tried to keep up with his own reading too, spending as much of his prison time as possible studying law and learning Afrikaans, the language of his oppressor. Among the most moving of the letters are those formal ones he wrote to the external registrar at the University of London, at which he was endeavouring to complete his bachelor of law degree, and asking if he might spread his Part II exams over a couple of years: “As a prisoner doing hard labour, I am experiencing considerable difficulty in preparing to write four subjects in one examination, and any concession you can offer in this regard will give me a fair chance of showing competent knowledge in each subject I offer…”

Elsewhere, in the midst of nearly 10,000 days of imprisonment he declared himself an early adopter of “self-help” wisdom. Writing in 1970 to support Winnie, who had herself been jailed, he urged her to try to read The Power of Positive Thinking by the American psychologist Norman Vincent Peale: “He makes the basic point,” Mandela noted, “that it is not so much the disability one suffers but one’s attitude to it. The man who says: I will conquer this illness and live a happy life, is already halfway through to victory.” No reader of Peale’s book can ever have taken that lesson more closely to heart.

• The Prison Letters of Nelson Mandela, edited by Sahm Venter, is published by Liveright (£25). To order a copy for £17.49 go to guardianbookshop.com or call 0330 333 6846. Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99