A novel written by Edinburgh-based author Maggie O'Farrell and inspired by Shakespeare’s son has won a prize voted for by booksellers, as it's named Waterstones Book of The Year.

Hamnet, set in 16th century Stratford-upon-Avon, was originally planned as a book about father and son.

Shakespeare wrote his tragedy Hamlet just a few years after the death of his only son, from the plague, aged 11.

But O’Farrell changed course after discovering that Shakespeare’s wife, Anne Hathaway, had been maligned by history.

READ MORE: Book review: Hamnet by Maggie O’Farrell

Hathaway, who was older than the Bard and married him while pregnant, has been depicted by “scholars, novelists and screenwriters” as “an illiterate peasant” who Shakespeare “ran away to London to get away from”, the Edinburgh-based author said.

“I was outraged on behalf of the woman we know as Anne Hathaway, because I feel that she has been treated with such sort of hostility, just barefaced misogyny,” the novelist added.

HeraldScotland: Maggie O'Farrell is "over the moon"Maggie O'Farrell is "over the moon"

But now O'Farrell is "over the moon", after Hamnet was chosen as Waterstones' Book of the Year.

She said: “It’s a huge honour to be added to this list, especially as I know that the award is nominated by those most discerning of readers, booksellers.

“Without their expert guidance and knowledge, my reading shelves would be much the poorer.”

Bea Carvalho, Waterstones’ fiction buyer, said that “for our booksellers, Hamnet is the clear standout title – a work of immense style and emotional heft which will surely go on to be a future classic”.

The novel previously scooped the Women’s Prize for Fiction.

Waterstones booksellers voted for the title they have most enjoyed recommending to customers over the course of the year.