Nathan Fillion
Nathan Fillion will play a weatherman in the upcoming season of Modern Family Frazer Harrison/Getty Images for Entertainment Weekly

Nathan Fillion may have hung up his boots as the best-selling mystery writer Richard Castle, but the actor has extended his run on ABC with a move to comedy. The lead in the hit crime show Castle which was cancelled after season 8, Fillion has signed on to star in a multi-episode arc on Modern Family.

The Prime Time Emmy award-winning show's co-creator Steve Levitan announced the news at the Television Critics Association's press tour on 4 August. Fillion will appear on the show as a weatherman named Rainer Shine "who gets involved with the Dunphys".

Veteran actor Martin Short will also be starring on the show's second episode of the upcoming season. He is slotted to play Merv Schechter, a promotional maven. Short will also be seen on NBC's Hairspray Live.

Modern Family season 8 is expected to premiere on ABC on Wednesday (21 September) at 9pm CT.

The gig with Modern Family is set to be Fillion's longest stint in a TV comedy. He was recently among the ensemble cast of web series Con Man and co-starred in Joss Whedon's Dr Horrible's Sing-Along Blog and had previously appeared in Community, Drunk History and Two Guys, A Girl And A Pizza Place.

Addressing numerous queries regarding the network's decision to axe the much-loved procedural, Castle, ABC Entertainment president Channing Dungey explained that it was a case where you have things running on parallel tracks".

"We were upfront with the studio that we may not be renewingCastle. But they had to prepare for season 9 and do what they needed to do should there be a Season 9. Ultimately, the network's decision was not to go for Season 9," Dungey said, according to Deadline.