A year ago this time, Stephen Colbert was shut out of the Emmys race for outstanding variety talk series and people were placing bets on how long it would take “Carpool Karaoke” mastermind James Corden to replace him. Now, not only is Colbert’s “Late Show” up for an Emmy, but he’s going to be hosting the awards show. More importantly, the comedian is flying high in the ratings game.

That’s a pretty stunning turnaround.

It always takes awhile for a new host to find his footing. By the time the Emmy nominations rolled around in 2016, Colbert had been at it for 10 months and the future looked grim. Jimmy Fallon’s “Tonight Show” was still getting all the love, with viral-ready shenanigans fueling primo ratings. And Corden, who has a similar shtick, had a solid fan base, too. Colbert, however, never embraced the childish gimmickry of the competition, and it looked like his show was suffering as a result. Maybe if he just agreed to swap mouths with his celebrity interviewees and sing show tunes, he too could be on top.

Good thing for him he didn’t because pretty soon audiences wanted a host who could get serious and talk politics. Liberal viewers also wanted someone who would pillory Donald Trump, and Fallon, with his giggly hair-mussing, wasn’t the guy for the job.

The big turnaround for Colbert came on election night, while hosting a special on Showtime (which is also up for an Emmy). Trump’s surprise victory threw all of Colbert’s preparations for the live event out the window.

“I think it’s when he became himself,” showrunner Chris Licht told the New York Times.

During the special, Colbert lost his sense of humor for a bit — “I can’t put a happy face on that, and that’s my job,” he said of Trump’s lead in the polls — but picked up a lot of fans. He was in his wheelhouse talking politics, and suddenly that’s all viewers wanted to hear about.

After the election, the late-night clips going viral no longer featured Fallon playing a preschooler’s xylophone but monologues by Colbert, Samantha Bee and Seth Meyers about the latest political scandals. Colbert started beating Fallon’s viewership numbers shortly after the election and, by May, the big news was that during the 2016-2017 season “The Late Show” ratings had bested “The Tonight Show.”

Colbert still isn’t the best interviewer for pop stars and young starlets, but he no longer has to be. He’s benefiting from a growing interest in people like Joe Scarborough and Mika Brzezinski, who just appeared on his show. Colbert has obviously changed — he’s grown more comfortable on stage — but he’s also cashing in on the fact that the world changed, too.

There have still been some bumps along the way. During one recent monologue, Colbert made a crude joke about the president doing intimate things with Russian President Vladimir Putin. The Federal Communications Commission investigated the incident but opted not to fine the host, but there was the inevitable online brouhaha. Trump supporters even got #FireColbert to trend on Twitter. But by then he was far from peril. With numbers this good, there’s no way CBS would give him the boot.

Read more:

From "Big Little Lies" to "This Is Us," this year's Emmy Awards will feature an array of co-stars nominated in the same categories. (Nicki DeMarco/The Washington Post)