Green Wing star Stephen Mangan is to play detective Dirk Gently in a screen adaptation of writer Douglas Adams' literary creation.
Mangan's sidekick Richard Macduff will be played by actor Darren Boyd, while Cold Feet's Helen Baxendale has been cast as Macduff's girlfriend.
Mangan said he was a big Adams fan and that it was a "thrill to be playing one of his brilliant characters".
Dirk Gently's Holistic Detective Agency is due on BBC Four this winter.
Filming of the drama has started in Bristol this week.
Dismissive and unreliable
The story sees Gently investigating the disappearance of an old lady's cat and unwittingly stumbling across a double murder.
Mangan, whose other credits include I'm Alan Partridge, revealed that he was a fan of Adams' Hitchhiker's Guide to the Galaxy on radio.
"I used to record [it] as a child and listen to [it] over and over again in my bedroom.
"Dirk is described as lazy, untidy, dismissive and unreliable. I've absolutely no idea why they thought I'd be right for the role," he added.
Ed Victor, Adams's agent, said: "For all the years I represented the late, great Douglas Adams, the most substantial frustration for both of us was that we couldn't get films made either of Hitchhiker or Dirk.
"Douglas once said, memorably, that 'getting a film made in Hollywood was like trying to cook a steak by having a bunch of people come into the room and breathe on it'.
"Well, we did eventually get a film made in Hollywood of Hitchhiker and, tragically, Douglas didn't live to see it. Nor will he see this adaptation of Dirk - but it's worth bearing in mind that Douglas always thought Dirk would make a better film than Hitchhiker."
The writer died in 2001 at the age of 49.