It’s Hulu’s loss and the fans’ gain. Former NBC comedy “Community” will continue on at Yahoo Screen.

In a surprise last-minute deal, the show’s producers Sony Pictures Television sold a 13-episode sixth season to the web video service.

“I am very pleased that Community will be returning for its predestined sixth season on Yahoo,” said show creator Dan Harmon in a statement. “I look forward to bringing our beloved NBC sitcom to a larger audience by moving it online. I vow to dominate our new competition. Rest easy, Big Bang Theory. Look out, Bang Bus!”

Also read: Insider: ‘Community’ Isn’t Dead Yet, Hulu Still in Talks With Sony

Star Joel McHale added, “The reports of our cancelation have been greatly exaggerated.” —Mark Twain (The other version of this quote has been wrong for years). # SixSeasonsAndaMovie is real. Thank you Sony. Thank you Yahoo. Thank you Dan Harmon. And thank you to the greatest f%$#ing fans in the history of the human race. It’s the internet. We can swear now.”

Word that another company had joined the talks to continue “Community” came last week as talks with Hulu were breaking down. For many, Hulu seemed the right place for “Community” as it owns the streaming rights to the previous five seasons.

The pressure was on as Sony tried to close a deal to continue the comedy with just days left on the cast’s contracts, which expire on Monday.

Also read: ‘Girls’ Books ‘Community’ Alum Gillian Jacobs for Season 4

“Yahoo is all about connecting the best creators to the audiences who love their work. ‘Community’ has an incredibly passionate and loyal fan base who have fought hard to keep this amazing show alive. We couldn’t be more excited to work with Dan, Joel, and the entire cast, as well as Sony, to deliver a great Season 6.” said Yahoo CMO, Kathy Savitt.

NBC canceled “Community” in March. Never really a ratings hit, the network aired five seasons of the show because it could trust that a certain amount of people — at least four million or so — would tune in loyally each week, and it was a critical darling.

The show did have its ups and downs. Creator and showrunner Dan Harmon was fired ahead of Season 4 amid complications with Chevy Chase and tales of bad time management, but he returned for the show’s fifth season. And it would end up losing original castmembers Chevy Chase and Donald Glover during Season 5.

Also read: Dan Harmon Responds to ‘Anxious Fans’ of Canceled ‘Community’

Remaining castmembers include Joel McHale, Gillian Jacobs (who has signed on for a recurring role on HBO’s “Girls”), Danny Pudi, Yvette Nicole Brown, Alison Brie, Ken Jeong and Jim Rash.

“Community’s” fifth-season finale on April 17 drew 2.87 million viewers and a 1.0 rating/4 share with the advertiser-coveted 18-49 demographic.