Le Morte d'Arthur, by Sir Thomas Malory Malory's collection of knightly yarns has served as a sourcebook for every Arthurian since. Imprisoned during the 1450s, perhaps for rape as well as theft, Malory filled the years he spent waiting for trial recalling the tales of chivalry that he then collected as one of Caxton's first bestsellers.

Don Quixote, by Miguel de Cervantes Cervantes was jailed two or three times, and he claims in his prologue to Don Quixote that his great mock-romance was "begotten in a prison". Confined to a cell, the author's imagination wanders with his crack-brained knight over the dusty roads of Spain.

Pilgrim's Progress, by John Bunyan Bunyan's allegory, narrating Christian's journey to the holy city, was written while he was incarcerated in Bedford jail for 12 years. He was imprisoned for refusing to cease public preaching. Where better than prison for a dissenting Protestant to write?

De Profundis, by Oscar Wilde In Reading jail, where he spent two years after being found guilty of "gross indecency", Wilde penned his apologia for his life and conduct. "I was a man who stood in symbolic relations to the art and culture of my age ... I became the spendthrift of my own genius, and to waste an eternal youth gave me a curious joy".

Memoirs of a Woman of Pleasure, by John Cleland While confined for a year in the Fleet debtors' prison in the 1740s, Cleland composed this peculiarly literary work of pornography, which is full of sex but has no rude words. Perhaps the intensity with which its scenes are imagined might have had something to do with its author's enforced chastity.

Our Lady of the Flowers, by Jean Genet Genet's first, largely autobiographical, novel was written in secret while its author was in prison for theft. The novel's homosexual narrator is also in prison, and is recalling some of his sexual encounters in explicit detail: "I have made myself a soul to fit my dwelling. My cell is so sweet."

"To Althea, from Prison", by Richard LovelaceThe Cavalier poet was jailed during the conflict between Parliament and Charles I after he led a march from Kent in support of the royalist cause. During his seven weeks in the Fleet prison he produced probably the most famous prison-lines in English poetry: "Stone Walls do not a Prison make, / Nor Iron bars a Cage; / Mindes innocent and quiet take / That for an Hermitage".

Pisan Cantos, by Ezra Pound Cantos LXXIV to LXXXIV were written while the poet - who had broadcast during the second world war in support of Mussolini's regime - was interned by the American army in a camp near Pisa. Deprived of his books and his freedom, Pound produced the most admired and accessible section of his magnum opus.

Justine , by the Marquis de Sade The infamous libertine spent much of his adult life in prison and wrote most of his novels there. His sexually explicit narratives - including this account of a virtuous girl in a wicked world of sexual predators - were composed to fill the tedious hours and compensate for the absence of women. The first draft was written in the Bastille.

A Hymn to the Pillory , by Daniel Defoe Defoe turned personal disaster into public relations triumph when he wrote this satire in Newgate prison while waiting to be put in the pillory. He had been sentenced for mocking high-church Tory intolerance of dissenters like himself. It was sold in the streets when he was eventually pilloried and made him the darling of the crowds who gathered to watch.