A Polish pulp fiction writer was sentenced to 25 years in jail yesterday for his role in a grisly case of abduction, torture and murder, a crime that he then used for the plot of a bestselling thriller.

In a remarkable case that has gripped Poland for months, Krystian Bala, a writer of blood-curdling fiction, was found guilty of orchestrating the murder seven years ago of a Wroclaw businessman, Dariusz Janiszewski, in a crime of passion brought on by the suspicion that the victim was sleeping with his ex-wife.

In the novel, the villain gets away with kidnapping, mutilating and murdering a young woman.

In real life, however, Bala got his comeuppance, even though it was seven years after the disappearance of the advertising executive whose murder confounded detectives until they read the book.

The killing of Janiszewski was one of the most gruesome cases to come before a Polish court in years, with the "Murder, He Wrote" sub-plot unfolding in the district court in Wroclaw and keeping the country spellbound.

Janiszewski, said to have been having an affair with Bala's ex-wife, was scooped out of the river Oder near Wroclaw in south-west Poland by fishermen in December 2000, four weeks after going missing.

The police tests revealed that he was stripped almost naked and tortured. His wrists had been bound behind his back and tied to a noose around his neck before he was dumped in the river.

The police had little to go on. Within six months, Commissar Jacek Wroblewski, leading the investigation, dropped the case. It remained closed for five years despite the publication in 2003 of the potboiler Amok, by Bala, a gory tale about a bunch of bored sadists, with the narrator, Chris, recounting the murder of a young woman. The details of the murder matched those of Janiszewski almost exactly.

Bala, who used the first name Chris on his frequent jaunts abroad, was arrested in 2005 after Commissar Wroblewski received a tip-off about the "perfect crime" and was advised to read the thriller. But Bala was released after three days for insufficient evidence, despite the commissar's conviction that he had his villain. When further evidence came to light, Bala was re-arrested. The case against him, however, remained circumstantial.

Police uncovered evidence that Bala had known the dead man, had telephoned him around the time of his disappearance and had then sold the dead man's mobile phone on the internet within days of the murder.

When Poland's television equivalent of Crimewatch aired details of the case in an attempt to generate fresh police leads, the programme's website received messages from various places in the far east, places that Bala, a keen scuba diver, was discovered to have been visiting at the time of the messages.

All along, Bala protested his innocence, insisting that he derived the details for the Amok thriller from media reports of the Janiszewski murder.

Sentencing Bala to 25 years' jail yesterday, Judge Lidia Hojenska admitted that he could not be found directly guilty of carrying out the murder. But the evidence sufficed to find him guilty of planning and orchestrating the crime. "The evidence gathered gives sufficient basis to say that Krystian Bala committed the crime of leading the killing of Dariusz Janiszewski," she said.

The court heard expert and witness evidence that Bala was a control freak, eager to show off his intelligence, "pathologically jealous" and inclined to sadism. "He was pathologically jealous of his wife," said Judge Hojenska. "He could not allow his estranged wife to have ties with another man."

His lawyer said yesterday that Bala would appeal against the verdict and sentence.

Stranger than Fiction

· William Burroughs' accidental killing of his wife Joan while attempting to shoot a glass off her head was later documented in his novel Queer. He wrote: "I am forced to the appalling conclusion that I would have never become a writer but for Joan's death."

· Thirteen years after OJ Simpson's acquittal for the murder of his wife, Nicole Brown Simpson, and her friend Ron Goldman, his controversial account of how he would have committed the crime was published. In a chapter entitled The Night in Question, Simpson describes his confrontation with Goldman, "Then something went horribly wrong, and I know what happened, but I can't tell you exactly how."

· In 2001 the son of author Errol Trzebinski was murdered in a similar manner to that described in her book The Life and Death of Lord Erroll. She believes the killing was a warning against an investigation she was conducting into the suspicious death of the 22nd Earl of Erroll, whom she believes was killed by the British intelligence services.

Holly Bentley