In the wake of his historic victory, President-elect Donald Trump is getting credit from an unlike source: Bill Maher.

The HBO host, who Trump once sued for $5 million over an orangutan sex joke, took his panel by surprise Friday night by inviting the incoming president onto his show and offing praise for his hard-fought victory.

"He won. He ran a vicious, vulgar campaign and I gave it back exactly in measure," Maher said. "I was also vicious and vulgar but he won and he did it his way. Nobody gets to sing that song more than Donald Trump."

Maher drew a parallel between Trump and reality star Kim Kardashian, who despite being mocked and ridiculed for her lack of talent has been able to amass a fortune upwards of $300 million dollars.

"She said, 'well I guess that takes some sort of talent,'" Maher said, quoting Kardashian's appearance on 60 Minutes. "I would say the same about Donald Trump. It takes some sort of talent, and maybe we should recognize that because we lost."

Despite winning the election, it appears Trump will lose the popular vote to Hillary Clinton by a larger margin that George W. Bush lost the popular vote to Al Gore during the 2000 election. But as Maher himself admitted, "He won by the rules."

Maher's praise of Trump didn't extend to those who put him in office. In a blistering monologue, the Real Time host blasted Trump's supporters while criticizing many of the positions he supports.

"Enjoy your victory, Trump voters," Maher said, "because when you're dying because you don't have health insurance to treat the infection you got from a back-alley abortion you had to get because of fetal lead-poisoning, you can say to yourself, 'At least I didn't vote for someone with a private email server.'"

Watch the full episode here (Maher's open invitation to Trump occurs at the 18:22 mark):