Magnum P.I. has been saved from cancellation, thanks to NBC.

After being canceled by CBS in May, NBC has picked up the serries starrring Jay Hernandez for seasons 5 and 6 and ordered 20 new episodes. According to Deadline, it brings the reboot’s run to 96 episodes.

'Magnum P.I.' was brought over to NBC after its surprise cancellation at CBS.

A reboot of the 1980s drama created which starred Tom Selleck, Magnum P.I. follows Thomas Magnum (Hernandez), a private investigator and former Navy SEAL who solves crimes in Hawaii after returning home from Afghanistan and repurposing his military skills.

Aside from Hernandez, Magnum P.I. stars Perdita Weeks, Zachary Knighton, Stephen Hill, Tim Kang and Amy Hill.

Though the show was one of the most-watched broadcast series on CBS, the network pulled the plug on the drama after four seasons.

Immediately following the cancellation, Universal Television started exploring potential new homes for the show. NBC was found to be the top contender and after deciding on a budget that worked for everyone, Magnum P.I. was rehomed.

Deadline previously reporrted that the canceled CBS series could be saved by either NBC or the USA Network, both of which are NBCUniversal properties. Universal Television, also an NBCUniversal property, co-produces the series, which would make this easier.

A scenario was said to be for new episodes to air on NBC while USA would run previous seasons of the action drama. No word yet on if the USA component would still happen.

'Magnum P.I.' follows in the footsteps of 'Brooklyn Nine-Nine'.

Magnum P.I. is the second show to be canceled and later picked up by NBC.

In 2018, the comedy series Brooklyn Nine-Nine was given the chop by Fox after five season. The day after it was cancelled, NBC acquired the show for its sixth season and remained at the network until August 2021.