NBC said late Friday it was picking up the cop comedy "Brooklyn Nine-Nine," one day after the show was canceled by Fox. Fans flooded social media with comments Thursday and Friday when Fox said it wouldn't be picking up the sitcom for a sixth season.

According to The Wrap, NBC Entertainment chairman Robert Greenblatt said in a statement that NBC has "regretted" selling the show to Fox in the first place.

"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," Greenblatt said. "I speak for everyone at NBC, here's to the Nine-Nine!"

Get Breaking News Delivered to Your Inbox

Though the show has a loyal following, the series has never had stellar ratings. The comedy stars Andy Samberg, Andre Braugher, Terry Crews, Melissa Fumero, Joe Lo Truglio, Stephanie Beatriz, Chelsea Peretti, Joel McKinnon Miller and Dirk Blocker.

Fans, including "Hamilton creator Lin-Manuel Miranda, begged for the show to come back. Even the Backstreet Boys chimed in with a clip from the show featuring suspects in a line-up singing "I Want It That Way."

On Friday, Crews told CBS News he is "super proud of all we've done and if by some incarnation we can come back in some kind of way -- another network or something -- I'm jumping at the chance, but as it stands right now, we are gone, and I'm not mad."

Crews says he's grateful for the run the show's had and says it's been "a privilege" to play a feminist, self-aware cop who loves his family. Crews tells CBS News he has a lot in common with his character, including their approach toward masculinity.

"As a man, you have to be invincible, which is impossible, and that's the thing that really, really resonates with a lot of people -- Terry Jeffords is not ashamed to say what he's scared of, and he doesn't even have to hide it through bravado," Crews says. "Terry's just like, 'I'm very, very scared right now and that's OK. We can talk about it and deal with it.' I see a lot of me in that, especially since I came out and went through all my therapy. I've been so transparent and able to do the same thing and just say what could hurt me and how I've been hurt."

Cast and crew tweeted their excitement late Friday.

So happy to announce:

NBC IS PICKING UP BROOKLYN 99 for SEASON 6!!! — The Lonely Island (@thelonelyisland) May 12, 2018

#Brooklyn99 IS COMING BACK FOR SEASON 6 YOU GUYS ON NBC!!!!! You did this!! You got loud and you were heard and you saved our show!! Thank you!! Thank you to NBC!! NINE NINE!!!!! pic.twitter.com/cTycfF4FoR — Melissa Fumero (@melissafumero) May 12, 2018

SQUAD YOU DID IT #BROOKLYN99 WILL BE ON NBC FOR OUR 6th SEASON! — Stephanie Beatriz (@iamstephbeatz) May 12, 2018

It’s NINE o’clock and the NINE NINE is now on NBC. We are so grateful for our fans. THANK YOU. You made this happen. And we’re excited about this amazing new chapter for Brooklyn Nine-Nine. ❤️👍🏻🚨 — JoeLoTruglio (@JoeLoTruglio) May 12, 2018