Stephen Colbert had the idea to invite Sean Spicer up on stage at the Emmys on Sunday night. He and his producers knew there would be blowback. And there's been a whole lot.

But Colbert thought it would be funny and surprising, and that's what mattered most.

Spicer scored points for comedy but sparked a raging debate: Should Colbert and the Emmys have given Spicer a platform to rehabilitate an image so badly tarnished by his brief stint working as President Trump's spokesman?

Was Spicer "in on the joke?" Was he essentially admitting to lying to the American people from behind the White House podium?

As the debate went on late Sunday night, Colbert was celebrating his first gig hosting the Emmys at a late-night party in Los Angeles. Spicer was there too, taking selfies with celebrities and gawkers. He seemed to revel in the attention.

Related: Emmys 2017: The big moments that have people talking

Spicer resigned from his job as White House press secretary in July and formally left the administration in August. Now he is hitting the speaker circuit, landing consulting gigs and looking for a potential TV commentator job. He will be a visiting fellow at Harvard Kennedy School's Institute of Politics this fall.

Many Democrats and some anti-Trump Republicans are offended that Spicer -- who peddled misinformation on behalf of his boss -- is being embraced by institutions like Harvard.

"Harvard and the Emmys based on 7 months lying in the WH," former Obama foreign policy adviser Ben Rhodes tweeted. "America is not exactly a meritocracy and false equivalence trumps reality."

Some might see his Emmys appearance as an audition -- similar to his sit-down with Jimmy Kimmel on ABC last week.

He stood behind a faux podium and told Colbert, "This will be the largest audience to witness the Emmys, period -- both in person and around the world," poking fun at his false assertion about crowd size at President Trump's inauguration.

Spicer's insistence that Trump had a record crowd, despite photographic evidence to the contrary, was the first of many incidents that eroded Spicer's credibility and made him into a punchline on "SNL."

His "SNL" impersonator, Melissa McCarthy, was in the audience during Sunday night's bit, furthering the idea that Spicer was winking at his reputation.

The Emmys surprise came together just a few days before Sunday's telecast. Colbert wondered aloud if Spicer might play along, and one of his "Late Show" producers then pitched it, according to a source with firsthand knowledge of the skit.

Spicer was already in Los Angeles for Kimmel's show last Wednesday. He briefly flew back east, to his home near Washington, then returned to Los Angeles for a secret dress rehearsal before the broadcast.

The auditorium was almost entirely emptied before Spicer practiced his lines, the source said, so that his participation wouldn't leak ahead of time.

The reveal went off without a hitch. From the live broadcast, it looked like the auditorium full of mostly liberal Hollywood celebrities lapped it up. There were laughs and lots of shocked faces.

Within minutes, however, a wave of criticism crested on social media. Journalists, activists and celebrities said they didn't think it was funny to treat Spicer's mendacious behavior like a throwaway laugh line.

The actor Zach Braff tweeted: "I'm not ready to laugh 'with' Sean Spicer. I think he is an evil, opportunistic liar that hurt our country."

The MSNBC host Lawrence O'Donnell commented that the Emmys "helped Spicer pump up his 'lecture' fees, which is all that matters to him now."

While many of the objections came from liberals, some conservatives also made arguments against the skit.

"I know people who were offered opportunities to lie for Donald Trump and quietly declined. Harvard & The Emmys calling the wrong folks," former Jeb Bush spokesman Tim Miller tweeted.

Among the counter-arguments: It was just a joke. And besides, wasn't Spicer actually admitting to his and Trump's dishonesty through comedy?

Colbert is an outspoken opponent of President Trump, and he doesn't fret about the perception that he's "normalizing" Spicer. "Donald Trump normalized Spicer," a source involved in the production said.

Spicer himself told The Hollywood Reporter that he hadn't considered the criticism his appearance might get. "I was more worried about the logistical reactions," he told the magazine after the show. "I've never wheeled a podium before. The one I'm used to is pretty stationary."

Both sources who spoke with CNN on Monday morning marveled at the way Spicer was mobbed by Emmys attendees both at the awards show and at the parties afterward.

"He could barely eat at the Governor's Ball, he was so popular," one of the sources said.

President Trump went from the entertainment world -- a hit show on NBC -- to politics. Now Spicer, a longtime spokesman for the Republican National Committee, is going in the other direction.

The Hollywood Reporter's Chris Gardner described Spicer in the auditorium lobby during the show, "posing for pics, drinking beer, soaking up all attention after onstage appearance."