Image caption Neil Gaiman has written an episode of Doctor Who for 2011

Writer Neil Gaiman has won the prestigious children's fiction prize - the Cilip Carnegie Medal - for his fantasy tale The Graveyard Book.

The novel, about an orphaned boy brought up by ghosts, has scored a literary double, having also won the Newbery Medal - the US equivalent of the Carnegie.

Gaiman, who grew up in the UK but now lives in the US, is best known for the Sandman comic series and his novels Stardust and Coraline - which became big-screen hits.

He was inspired to write The Graveyard Book when his son rode into a graveyard on his tricycle. The story echoes the plot of Rudyard Kipling's The Jungle Book, in which orphan Mowgli who is brought up by animals in the jungle.

The Graveyard Book fought off competition from other shortlisted books by authors including Terry Pratchett and Philip Reeve.

'Worth the wait'

Gaiman said: "For my seventh birthday I was given a boxed set of the Narnia Books by CS Lewis. The last of them, The Last Battle, had the words 'Winner of the Carnegie Medal' on it. I did not know what the Carnegie Medal was, but I knew it was something important.

"It was the first literary award I had ever heard of. And if the Narnia books had won it, then it had to be the most important literary award there ever was."

Gaiman said he had first started writing The Graveyard Book at the age of 25.

"And now I'm almost 50, it was worth the wait," he said.

Margaret Pemberton, chair of the judges, said: "With great skill Gaiman has created a gripping page-turner, expertly supported by well-developed characters, that is full of humour and humanity."

Gaiman's first children's book was The Day I Swapped My Dad for Two Goldfish (1997).

He has also written an episode of the BBC TV series Doctor Who which is due to be filmed later this year and broadcast in 2011.

The Carnegie Medal is awarded by children's librarians for an outstanding book for children and young people.

It was set up in 1936 in memory of Scottish-born philanthropist Andrew Carnegie and was first awarded to Swallows And Amazons author Arthur Ransome for Pigeon Post.

The prize is a golden medal and £500 worth of books to donate to a library of their choice.

In 2007, Philip Pullman's Northern Lights was named the best children's book of the past 70 years from a list of past winners of the Carnegie Medal.

Previous medal winners include Richard Adams for Watership Down in 1972 and Mary Norton for The Borrowers in 1952.

A programme looking at the history of the prize, Carnegie Classics, is on BBC Radio 4 on Thursday 1 July at 1130 BST