NBC has decided to rescue Brooklyn Nine-Nine after a storm of protest on social media over Fox’s decision to scrap the US police sitcom.

The series, which stars comedians Chelsea Peretti and Andy Samberg, has gained millions of followers for its diverse cast and the manner in which its storylines address discrimination in the New York Police Department.

When it emerged that Fox would not be renewing the series, fans pleaded with other networks to pick up the show.

The highly vocal fans posted gifs and clips from the show on Twitter and Instagram and mounted a petition demanding that the series continue.

We need your consent to load this YouTube contentWe use YouTube to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

Mexican director Guillermo del Toro also lent his support. He tweeted: Brooklyn Nine-Nine has given us fully human characters, beautiful, powerful, flawed, vulnerable, majestic... In whichever form, B99 must return. It will. And I will be there to watch. And, it is my hope that I hope that, this time, a lot more people do too."

NBC’s head of entertainment, Robert Greenblatt, declared: "Ever since we sold this show to Fox I’ve regretted letting it get away, and it’s high time it came back to its rightful home.

"Mike Schur, Dan Goor and Andy Samberg grew up on NBC and we’re all thrilled that one of the smartest, funniest and best cast comedies in a long time will take its place in our comedy line-up. I speak for everyone at NBC, here’s to the Nine-Nine!"