NBC has ordered an extra five episodes for “Brooklyn Nine-Nine” Season 6, the broadcaster announced Friday.

That brings the cop comedy series’ sixth season to 18 episodes total. The series was canceled at Fox after five seasons back in May, with NBC saving the show shortly thereafter. Producer Universal Television had been in talks with Hulu to keep the series afloat, but the streaming service ultimately passed.

With the move, series executive producer and co-creator Mike Schur will have three shows on NBC for the 2018-2019 season. Along with “Brooklyn Nine-Nine,” NBC also airs the critically acclaimed single-camera comedy “The Good Place” and will air the multi-cam “Abby’s,” about an unlicensed bar in San Diego.

The move also marks a homecoming of sorts for series star Andy Samberg, who was previously a cast member on the long-running NBC series “Saturday Night Live.”

The cast of “Brooklyn Nine-Nine” includes Samberg, Andre Braugher, Terry Crews, Melissa Fumero, Joe Lo Truglio, Stephanie Beatriz, Chelsea Peretti, Dirk Blocker, and Joel McKinnon Miller.

Schur, Dan Goor, David Miner, and Luke Del Tredici executive produce. Universal Television, Fremulon, Dr. Goor Productions, and 3 Arts Entertainment produce.

Fans of “Brooklyn Nine-Nine” were stunned when Fox announced it was canceling the show. A large online push began immediately to save the comedy, with celebrity fans like Lin-Manuel Miranda and Mark Hamill leading the charge by sharing hashtags like #SaveB99 and #RenewB99.