William Shatner, the Canadian actor who defined sci-fi heroics with his role as Star Trek's Captain James T. Kirk, is trying on a different kind of legend in his latest role, playing iconic American writer and humorist Mark Twain in CBC's Murdoch Mysteries.

Actors William Shatner and Yannick Bisson appear on the set of CBC's hit period detective drama Murdoch Mysteries. Production has begun in Toronto and southern Ontario on Season 9 of the hit series, which will begin airing on CBC later this fall. (CBC/Shaftesbury productions) The Montreal-born actor will play the mustachioed The Adventures of Tom Sawyer author in an episode titled Marked Twain, set in 1903 Toronto.

"This is my time," quipped the 84-year-old actor on set Wednesday. Despite donning Twain's signature white suit and soup strainer, Shatner says he looks nothing like the southern novelist.

"Twain was tall and slim with white hair, at least when he got older, so I am playing my version of it."

As the episode's title suggests, Twain will be forced to seek the protection of Detective William Murdoch (Yannick Bisson) after a controversial speech stirs up death threats.

Bisson, who has played the titular character since the show's 2008 premiere, says they snagged Shatner for the historical drama using some very modern means.

"Twitter is how it happened, as far as I know," said Bisson. "Someone flat out asked 'Hey, William Shatner, when are you gonna do an episode of Murdoch Mysteries?' and then they tagged me."

After a few more re-tweets and some emails to the Murdoch Mysteries team, Shatner obliged.

"I didn't dare say anything to anyone until he showed up on our set yesterday," Bisson added. "Hard to believe but there he is."

Long line of famous figures

Set in Toronto at the dawn of the 20th century, Murdoch Mysteries is a one-hour drama series that explores the intriguing world of William Murdoch (Yannick Bisson), a methodical and dashing detective who pioneers innovative forensic techniques to solve some of the city's most gruesome murders. (CBC) Twain is just the latest historical figure to be brought to life on the long-running drama.

Nikola Tesla, Thomas Edison, Harry Houdini, Winston Churchill and Bat Masterson have all appeared on the show, which follows the methodical and dashing detective Murdoch as he solves some of Toronto' s most gruesome crimes with his radical forensic techniques.

In 2011, long-time fan Prime Minister Stephen Harper also made a cameo appearance on the program, which boasts an average audience of 1.3 million each week in Canada.

Bisson, Hélène Joy (Dr. Julia Ogden), Thomas Craig (Inspector Brackenreid), Georgina Reilly (Dr. Emily Grace) and Jonny Harris (Constable George Crabtree) will all return during the ninth season, which is currently filming in Toronto and other parts of southern Ontario.

The new season of Murdoch Mysteries is due to return to CBC later this fall.