On Monday, Sony Pictures Television, the studio that produces “Community,” announced the return of that NBC comedy’s prodigal creator, Dan Harmon, who will be its show runner for the coming season after being pushed out of the top job a year ago.

In a statement Sony said that Mr. Harmon would return to “Community” for its fifth season, as would Chris McKenna, a writer and producer who has worked on previous seasons of the show. Each will have the title of executive producer, the studio said. Sony and NBC declined to comment further on Monday. Mr. Harmon did not immediately respond to a request for comment.

Under Mr. Harmon, a creator of “The Sarah Silverman Program,” “Community” evolved over its first three seasons from a show about the mismatched members of a college study group to a rapid-fire satire of science fiction, alternate realities and paintball contests gone awry.

But the audience for “Community” never grew much beyond its core fan base, whose members blogged and tweeted about it passionately; at the end of its third season it was drawing fewer than three million viewers for broadcasts of new episodes.

Even so, for NBC, a struggling if recognizable show like “Community” was evidently worth holding onto. While the network has had its overall problems in recent years, its prime-time comedy lineup — once an NBC hallmark — has been a particular challenge, and it has lost signature series like “30 Rock” and “The Office.”

Over the seasons Mr. Harmon has tested the patience of studio and network executives with what could be seen as a relentless pursuit of perfection or an unwillingness to adhere to deadlines. And he feuded publicly with the “Community” co-star Chevy Chase, who is not known as a retreating personality.

In May 2012, NBC renewed “Community” for an abbreviated 13-episode fourth season, but just as its devotees exhaled their sighs of relief, Mr. Harmon announced in a post on his personal blog that Sony was removing him as show runner.

In the post Mr. Harmon vented his frustrations at Sony, NBC and the network’s entertainment chairman, Robert Greenblatt, who had said that Mr. Harmon might continue on “Community” in some other capacity.

“That’s a misquote,” Mr. Harmon wrote. “I think he meant to say he’s sure cookies are yummy, because he’s never called me once in the entire duration of his employment at NBC.”

Seeming to slam the door on any future involvement with the show, Mr. Harmon added, “I’m not saying you can’t make a good version of ‘Community’ without me, but I am definitely saying that you can’t make my version of it unless I have the option of saying, ‘it has to be like this or I quit’ roughly 8 times a day.”

In its fourth season “Community” was run by the producers David Guarascio and Moses Port, who work as a team (“Happy Endings,” “Just Shoot Me”). They were criticized for trying to duplicate Mr. Harmon’s frenetic pop style without matching his wit or his heart. Reviewing the season for The New York Times, Mike Hale wrote, “Apparently the new producers know what we want, but they won’t, or can’t, give it to us.”

It did not help matters that NBC delayed the season premiere of “Community” to Feb. 7 from Oct. 19 of last year, resulting in Halloween-, Thanksgiving- and Christmas-themed episodes that were shown months after those holidays. Mr. Chase left the series in November, and ratings for the season fell from the year before.

Even so, NBC announced in May that it had renewed “Community” for another 13 episodes. A few weeks later Mr. Harmon told audience members at the recording of his “Harmontown” podcast that he had been asked to return to “Community.” After several more days of teasing fans with the possibility, Mr. Harmon wrote on his Twitter account: “Yes yes yes! I’m back I’m back I’m back.”

Before his reconciliation with “Community” had been confirmed, Mr. Harmon made it known that he was immersing himself in his work. Last weekend he tweeted: “I have a LOT of scripts to read today so you’ll be seeing even more twitter activity than when I’m supposed to be writing them.”