The Da Vinci Code author Dan Brown did not breach the copyright of an earlier book, London's High Court has ruled.
Dan Brown said he was "astonished" his fellow authors took legal action
Michael Baigent and Richard Leigh, who wrote 1982 book The Holy Blood and the Holy Grail, sued Random House, publisher of both books.
Mr Brown said the verdict "shows that this claim was utterly without merit".
The ruling clears the way for the Da Vinci Code movie's release in May. Mr Baigent and Mr Leigh must pay 85% of Random House's costs of almost £1.3m.
Both books explore the theory that Jesus and Mary Magdalene had a child and the bloodline survives to this day.
BATTLE OF THE BEST-SELLERS
The Da Vinci Code
Author: Dan Brown
Global sales: 40m+
The Holy Blood and the Holy Grail
Authors: Michael Baigent, Richard Leigh, Henry Lincoln
Global sales: 2m+
Mr Baigent and Mr Leigh argued that Dan Brown copied their book's "central theme".
But the judge, Mr Justice Peter Smith, said The Holy Blood and the Holy Grail did not have a central theme in the way its authors suggested.
"It was an artificial creation for the purposes of the litigation working back from the Da Vinci Code," he ruled.
Dan Brown did use the previous book to write certain parts of his thriller, the judge decided, but did not substantially copy their work.
Mr Brown said he was "still astonished that these two authors chose to file their suit at all".
A novelist must be free to "draw appropriately" from historical works without facing a court and having his integrity called into question, he said.
"After devoting so much time and energy to this case, I'm eager to get back to writing my new novel."
Random House chief executive Gail Rebuck welcomed the judgement, saying: "We are pleased that justice - and common sense - have prevailed.
"It is highly unusual and very sad that these authors chose to sue their publishers, especially after 20 successful years."
The verdict was "very important for the future of creative writing in the UK", she added.
Mr Justice Smith ordered Mr Leigh and Mr Baigent to make an interim payment of £350,000 by 5 May and refused the authors permission to appeal.
Mr Leigh told reporters outside the court: "I think by its very nature, this case entailed a conflict between the spirit of the law and the letter of the law.
"We lost on the letter of the law, I think we won on the spirit of the law, and to that extent we feel vindicated."
Despite the judge's ruling, Mr Baigent and Mr Leigh said they intend to appeal.
The third author of The Holy Blood and the Holy Grail, Henry Lincoln, did not take part in the claim.
There had been fears that the Hollywood blockbuster of The Da Vinci Code, starring Tom Hanks and Audrey Tautou, could be delayed if the ruling went the other way.
Film company Sony welcomed the result and said it would release the film as planned next month.
The Da Vinci Code is still in the UK top 10 book sales chart, while The Holy Blood and the Holy Grail is back in the top 40 thanks to the controversy.
Mr Justice Smith added: "It is a fact that the claimants' book sales have benefited from The Da Vinci Code (and this litigation)."