Mohamedou Ould Slahi, a Mauritanian who has been detained in Guantánamo since 2002 despite never having been charged with a crime by the US, is to publish an account of his experiences next year, detailing the multiple forms of torture to which he has been subjected and "shatter[ing]" the secrecy that surrounds the Cuban prison.

Slahi's book, which has just been acquired at auction, is the first diary to be released by a still-imprisoned Guantánamo detainee, said publisher Canongate. Written in 2005, in his segregation cell, it started out as letters from the author to his lawyers, who fought for seven years to have the manuscript declassified. Parts still remain redacted.

Slahi had voluntarily turned himself in for questioning in his native Mauritania in 2001; from there a CIA rendition plane took him to Jordan, where he was held and interrogated for eight months before the Jordanians cleared him. The US, however, then sent him first to Bagram in Afghanistan, and then to Guantánamo, where he was designated a "special project" and subjected to isolation, beatings, sexual humiliation, death threats, and a mock kidnapping and rendition, said his publisher.

In 2010, his immediate release was ordered in the Washington, DC federal court, but the decision was appealed by the government and Slahi and his lawyers are awaiting another hearing. The 20 January 2015 publication of his book, which will be edited and introduced by author and human rights advocate Larry Siems, will form the basis of an international campaign to free him.

An extract published by Slate last year reveals harrowing details of Slahi's ordeals, from sexual humiliation to the freezing cold cell in which he was imprisoned. "The cell – better, the box – was cooled down so that I was shaking most of the time," he writes. "I was forbidden from seeing the light of the day. Every once in a while they gave me a rec time in the night to keep me from seeing or interacting with any detainees. I was living literally in terror. I don't remember having slept one night quietly; for the next 70 days to come I wouldn't know the sweetness of sleeping. Interrogation for 24 hours, three and sometimes four shifts a day. I rarely got a day off."

Siems, the lead writer on The Torture Report, which sets out to document the Bush administration's torture programme, said that Slahi's ordeal "almost defies the imagination". The Mauritanian, said Siems, "endured one of the most stubborn, brutal, and deliberate interrogations on record", despite never having been accused of any crime by the US.

"Slahi's treatment in Guantánamo is among the most extreme, and most well-documented, cases of torture in the record," said Siems. "When, after more than six years of litigation and negotiations, his lawyers succeeded in getting a redacted version his manuscript cleared for public release, they asked if I would like to see it. I couldn't believe it: I knew from the record how vivid and harrowing his story was likely to be, and from bits of his voice in the transcripts of his Guantánamo hearings that he was very likely to be an insightful and compelling storyteller. Of course I said yes. The manuscript is 466 pages, handwritten, in English – a language he largely acquired in Guantánamo. It did not disappoint."

Guantánamo Diary. Photo: Canongate Books

Guantánamo Diary is, said Canongate, "not merely a vivid record of a miscarriage of justice, but a deeply personal memoir – terrifying, darkly humorous, and surprisingly gracious", and "a document of immense historical importance".

Slahi's lawyer, Nancy Hollander, said that Slahi had never been charged with any crime. "We have been fighting for his release since we learned about his case in 2005," she said. "This book is a window into the prison in Guantánamo Bay, written by a young man who suffered physical and psychological torture but who can still separate the good from the bad and the truth from the lies and present it all in a language he learned from his guards ... The reader will learn what the United States government has tried to keep secret."

Hollander, who saw Slahi last week, said he was "pleased" about the deal for his diaries, and "grateful to all the people who have made this book a reality". "He is well considering that he has been imprisoned for 14 years," she said of the prisoner. "His spirit remains strong and he is continuing to study. He can now read and speak in Spanish – his fifth language."

The book, said Siems, "really shatters that secrecy that surrounds Guantánamo". "Guantánamo was devised in and for secrecy; secrecy was essential in order that the abuses that took place there could happen, and it was even more essential to conceal those abuses, and the many grave mistakes and bad decisions that accompanied those abuses, from public view. To maintain that secrecy, two groups of voices have been almost completely suppressed: the voices of the men and women who served in the facility, and found themselves in the middle of these terrible policies, and the voices of the prisoners themselves. Guantánamo Diary gives us both – which has something to do with why it remained classified for so long, I'm sure."

Siems added that, as a writer, Slahi also "manages to do something that I think very few of us could do: he treats everyone he writes about as individuals, trying, as he puts it, 'to be as fair as possible to the US government, to my brothers, and to myself'. In doing that, he renders an account of Guantánamo that is unlike anything we have seen before, one where humour and unexpected kindnesses exist alongside dumbfounding degradations and brutalities".