Lyle, best known for her role as Marsali Fraser in Outlander, will play the young and fearless investigator in the new three-part ITV series, which comes from the makers of Line Of Duty.
Based on Edinburgh-based author McDermid’s first Pirie novel, the series will also star Emer Kenny, who has adapted the book.
Kenny will play DS Pirie’s friend, River Wilde, while Chris Jenks will play Jason “The Mint” Murray and Zach Wyatt will play DS Phil Parhatka.
The series, called Karen Pirie, will see the detective tasked with reopening a historic murder investigation.
Teenager Rosie Duff was found brutally murdered in St Andrews in 1996 and suspicion fell on the three drunken students who were discovered at the scene of the crime, claiming to have found her body.
With a lack of forensic evidence, no charges were brought and the police investigation floundered.
However, 25 years later, someone appears to be willing to risk everything to keep the secrets surrounding the case hidden and DS Pirie will investigate whether the three men know more than they previously revealed.
Lyle said: “I am completely overjoyed to be bringing the formidable force that is DS Karen Pirie to life through Emer Kenny’s slick adaptation.”
McDermid said: “It’s always exciting to see a project like Karen Pirie leave the page and head for the screen.
“We’ve been fortunate to secure a very talented and enthusiastic cast to bring The Distant Echo to life, and shooting in Scotland is definitely added eye-candy.”