Queensberry's libel trial began on 3 April 1895. It soon became clear that the actions on trial there were Wilde's, not Queensberry's. The defense's lawyer grilled Wilde on his lifestyle, asking about his relationships with men, picking apart his published works and reading his letters to Alfred Douglas in court. Wilde defended himself with his trademark wit, and refused to renounce or deny his homosexuality.
At one point, defense lawyer Edward Carson read excerpts from the preface to Dorian Gray as evidence. Wilde defended his thesis that morality and art were two separate things, prompting this exchange:
"Carson: Then, I take it, that no matter how immoral a book may be, if it is well written, it is, in your opinion, a good book?
Wilde: Yes, if it were well written so as to produce a sense of beauty, which is the highest sense of which a human being can be capable. If it were badly written, it would produce a sense of disgust.
Carson: Then a well-written book putting forward perverted moral views may be a good book?
Wilde: No work of art ever puts forward views. Views belong to people who are not artists.
Carson: A perverted novel might be a good book?
Wilde: I don't know what you mean by a "perverted" novel.
Carson: Then I will suggest Dorian Gray as open to the interpretation of being such a novel?
Wilde: That could only be to brutes and illiterates. The views of Philistines on art are incalculably stupid."
Queensberry was acquitted of libel, but Wilde was then immediately arrested and charged with gross indecency. On 25 May 1895 he was convicted of gross indecency and sentenced to two years of hard labor. He was sent immediately to prison, eventually transferring to Reading Gaol.
The trial destroyed Wilde's reputation. His wife Constance packed up their two young sons, took them to Switzerland, changed their names and never allowed them to see Wilde again. (Though the couple never lived together again, they remained legally married and Constance continued to send him financial support.) His former lover, Bosie, never came to visit him in prison. "Unfortunately," Wilde wrote to a friend, "I spent on him my life, my genius, my position, my name in history; for these no little, or big return is possible."