“The Apprentice” debuted in 2004, and immediately scored an Emmy nomination for outstanding reality competition show. It lost to CBS’s “The Amazing Race.”

Executive producer and host Donald Trump was not pleased. “I got screwed out of an Emmy,” he recalled during a 2015 episode, when it was revealed celebrity contestant Leeza Gibbons does, in fact, have an Emmy. “Everybody thought I was gonna win it. Like, in fact, when they announced the winner, I stood up before the winner was announced.”

“I started walking for the Emmy,” Trump continued. “And then they announced the most boring show on television, piece of crap. I literally stood up and started walking out.”

And so began Trump’s feud with the Television Academy, which he made public over the years, on television and Twitter. How he handled those Emmy losses even got a mention during Wednesday night’s presidential debate — after he declared he will keep the nation “in suspense” over whether he would accept the election results if he lost.

“You know, every time Donald thinks things are not going in his direction, he claims whatever it is is rigged against him,” Democratic nominee Hillary Clinton said, later adding he “started tweeting that the Emmys were rigged against him.”

“Should have gotten it,” Republican presidential nominee Trump interjected, to laughter in the audience.

Trump himself has never been nominated for an individual Emmy, though he and Mark Burnett are listed as executive producers on “The Apprentice.” The show received two nominations in the outstanding reality competition category, and seven others in categories such as cinematography and picture editing.

“Donald Trump is talking about the actual show ‘The Apprentice’ being nominated for an Emmy in the Outstanding Reality Competition category, as opposed to him being nominated for an individual Emmy for hosting,” Entertainment Weekly executive editor Dalton Ross wrote in 2015 of the ongoing feud. “I know this because I once went out to dinner with Donald Trump, in part because he wanted it explained to him why he was not being nominated for Emmys. It was the best dinner of my entire life.”

Trump’s disdain toward the Emmys wasn’t immediate. He showed up at the awards show in 2006 and performed a weird homage to reality shows and “Green Acres” with Megan Mullally of “Will & Grace.” He wore overalls.

By 2011, Trump had had it. “The Apprentice,” coming off its 11th season, hadn’t received a nomination in years. He went on YouTube to blast the Emmys, saying “fewer and fewer people” watch the show “and for good reason.” The academy awards the wrong shows and people, Trump said, and “it’s really not a good operation.”

“The public is smart. They know it’s a con game. I remember when I was originally nominated, everybody thought that ‘The Apprentice’ was going to win. It was the hottest thing on television, virtually,” Trump said in 2011. “Well, it didn’t win. They picked another show that frankly has been nominated many years and it’s like, an irrelevant show. I’m not talking about myself. I’m not talking about ‘The Apprentice.’ I’m just saying the Emmys have a become boring, boring, boring show, totally predictable, and they’re picking the wrong people.”

Then the tweets began. For two days after the 2012 Emmys, he fired off a series of them. “‘Amazing Race’ winning an Emmy again is a total joke. The Emmys have no credibility — no wonder the ratings are at record lows,” reads one.

“The Emmys are all politics, that’s why, despite nominations, ‘The Apprentice’ never won — even though it should have many times over,” reads another.

He live-tweeted the 2013 show, writing that “The Apprentice” wasn’t nominated due to “pure politics!”

Trump took non-Emmy nights to complain about the show. During the 2014 Oscars telecast — months before the Emmy awards show — he tweeted, “which is worse and which is more dishonest — the Oscars or the Emmys?”

So when Trump’s long-running feud with the Emmys received a presidential debate mention on Wednesday night, the Television Academy responded in kind.

“Rest assured,” the organization tweeted, “the Emmys are not rigged.” It then linked to a massive graphic that explains the entire nominating process.

To date, “The Amazing Race” has been nominated 71 times, and won 10 times in the outstanding reality competition category.

“I don’t know what to say anymore,” the CBS show’s executive producer, Bertram van Munster, said in a 2010 acceptance speech. “All these Emmy awards and all the other wonderful things we have won for this show. I’m really speechless.”

Trump and NBC parted ways in 2015, and the reality show is coming back in January with Arnold Schwarzenegger as host.

“The Apprentice” has yet to win an Emmy.

Read more:

Donald Trump and Hillary Clinton met on the debate stage for one final showdown, and late-night comedians were tuned in for a laugh. (The Washington Post)