Former policewoman Clare Mackintosh has beaten JK Rowling to the Theakstons Old Peculier crime novel of the year award.

Harry Potter author Rowling was shortlisted for Career Of Evil, written under her pen name Robert Galbraith, but lost out to Mackintosh with her debut thriller, I Let You Go.

Mackintosh spent 12 years in the police force but left in 2011 and became a full-time writer.

The crime-writing prize is now in its twelfth year, with previous winners including Val McDermid, Lee Child, Mark Billingham, Sarah Hilary and Denise Mina.

Mackintosh, who will receive £3,000, beat off competition from a shortlist of six British and Irish authors whose novels were published in paperback between May 1 2015 and April 30 2016.

I Let You Go was a Sunday Times bestseller and a Richard and Judy book club winner in 2015.

At the awards ceremony in Harrogate, previous winner McDermid was also presented with a special prize, the Theakstons Old Peculier outstanding contribution to crime fiction award.

Fellow crime writer Rowling said she was grateful to McDermid for a positive review of Galbraith’s writing, before his true identity was revealed.

Val McDermid and JK RowlingVal McDermid and JK Rowling (Fenris Oswin)

She said: “I’d like to add my note of congratulations to my friend and colleague Val McDermid, for her justly deserved outstanding contribution to crime fiction award. She has been showing us all the way for a long time now.

“One of Robert’s proudest moments was receiving a favourable review from the great McDermid, who received a thank you note in fake handwriting, only to receive one two weeks later in my real handwriting when I was unwillingly unmasked.”

McDermid, whose 30th novel Out Of Bounds will be published in August, said: “It’s an honour and a thrill to receive this award.

“The community of writers and readers at the Theakston Old Peculier Crime Writing Festival is unlike any other in its warmth and generosity and so this means a huge amount to me.

“This year sees the publication of my 30th novel and I can’t think of a better way to celebrate that.”