NBC has ordered two seasons of “Magnum P.I.” following the drama’s cancellation at CBS in May after a four-season run.

The broadcaster has ordered 20 new episodes of “Magnum P.I.,” which an option for more, and intends to break those up into Seasons 5 and 6 of the series, Variety has learned.

The reboot of the beloved 1980’s action series debuted Season 4 back in October on CBS. The show is described as a modern take on the original series centering on Thomas Magnum (Jay Hernandez), a decorated former Navy SEAL who, upon returning home from Afghanistan, repurposes his military skills to become a private investigator.

Along with Hernandez, the series stars Perdita Weeks as Juliet Higgins, Zachary Knighton as Orville “Rick” Wright, Stephen Hill as Theodore “TC” Calvin, Tim Kang as Det. Gordon Katsumoto, and Amy Hill as Teuila “Kumu” Tuileta.

Eric Guggenheim serves as executive producer and showrunner, with Barbie Kligman, John Davis, Justin Lin, and John Fox also executive producing. CBS Studios produces in association with Universal Television. Peter Lenkov developed the reboot with Guggenheim, but Lenkov was fired from the show and his other CBS productions in 2020 after toxic workplace accusations came to light.

Airing Fridays at 9 p.m. on CBS, “Magnum P.I.” Season 4 averaged 0.7 rating among adults in the key adults 18-49 demographic and 7.2 million total viewers, according to Nielsen’s Live + 7 data. Those numbers include a week’s worth of delayed viewing, mostly via DVRs, where available.

“Magnum P.I.” was among several series canceled at CBS this spring ahead of parent company Paramount Global’s “upfront” presentation to advertisers in New York, when it revealed its Fall 2022 slate of new and returning series. Also canceled were “United States of Al,” B Positive,” “Good Sam” and “How We Roll.”

Deadline first reported “Magnum P.I.” had been picked up for Seasons 5 and 6 at NBC.