Will Eaves’s fictionalised account of the chemical castration of Alan Turing, Murmur, was hailed as “a future classic” as it won the £30,000 Wellcome book prize on Wednesday night, only the third novel to win the award for science-related writing.

Published by Charles Boyle’s one-man-band press CB Editions, Murmur was up against both fiction and non-fiction for the prize, which goes to the book that best “illuminate[s] the many ways that health and medicine touch our lives”. It beat titles including Thomas Page McBee’s memoir Amateur, about becoming the first transgender man to box at Madison Square Gardens, and cardiologist Sandeep Jauhar’s Heart, a history and memoir of the organ.

Murmur, which started life as a short story, is the fifth novel by Eaves, a former arts editor of the Times Literary Supplement who now teaches at the University of Warwick. Through the figure of Alec Pryor, modelled closely on Turing, it tells of how the brilliant mathematician was sentenced to a regime of hormonal injections after he was convicted of gross indecency with another male, dying two years later in an apparent suicide. The Wellcome judges called it an “extraordinary contemplation of consciousness” and “a feverish meditation on love, state-sanctioned homophobia and knowledge, alongside an exploration of sexuality, identity and artificial intelligence”.

“Fear of homosexuals is never far from the surface,” writes Eaves, as it opens. “The few people who have supported me after my conviction must be very strong-minded. I do not think most people are equipped to associate with pariahs. They have a shadowy sense of how frail they themselves would be in the face of institutional opposition and stigmatisation … It is not hatred that turns the majority against the minority, but intuitive shame.”

Chair of judges, the novelist Elif Shafak, called Murmur “hugely impressive”, adding that it “will grip you in the very first pages, break your heart halfway through, and in the end, strangely, unexpectedly, restore your faith in human beings, and their endless capacity for resilience”.

“Every sentence, each character … is well-thought, beautifully written and yet there is a quiet modesty all the way through that is impossible not to admire,” said Shafak. “Whether he intended this or not, Will Eaves has given us a future classic and for this, we are grateful to him.”

Already nominated for the Goldsmiths, James Tait Black and Folio prizes, and winner of the Republic of Consciousness award, Murmur has received rave reviews, with the Guardian calling it “as bracingly intelligent as it is brave” and the New Scientist describing it as “an extraordinary exploration of dreams, consciousness, science and the future”. Paperback rights have been acquired by Canongate.