Nick Cannon says his time hosting America's Got Talent has come to an end.

In a lengthy message posted Monday on his Facebook account, the comedian says he will not be returning to the NBC reality competition for season 12 after executives at the network threatened to fire him over a racial joke he made in a recent Showtime stand-up special.

"I was to be punished for a joke. This has weighed heavy on my spirit. It was brought to my attention by my 'team' that NBC believed that I was in breach of contract because I had disparaged their brand," wrote Cannon. "I find myself in a dark place having to make a decision that I wish I didn't have to, but as a man, an artist, and a voice for my community I will not be silenced, controlled or treated like a piece of property. There is no amount of money worth my dignity or my integrity."

The joke in question aired as part of Cannon's Showtime special, Stand Up, Don't Shoot, which premiered Friday on the pay cabler. "I honestly believe, once I started doing America’s Got Talent, they took my real n—r card. They did! Because then like these type of people started showing up to my shows,” Cannon said in the special as he jokingly pointed to three older white audience members in the front row. “I can’t do the real n—r stuff no more, because then they’ll put me on TMZ."

Earlier in his Showtime special, his third on the pay cabler, Cannon made several jokes about NBC and the difference in language he used in the special compared to the more family-friendly reality competition.

"That's what NBC is gonna stand for tonight: 'N—rs better come on, 'cuz n—rs be cussin', so n—rs be careful," said Cannon. "'Cuz y'all see me on the show. I mean sometimes I wish I could say the stuff that I want to say. … But I can't say that. I can't talk like that 'cuz that would mess up the white money. It will."

In an interview with Howard Stern on Friday morning, Cannon said he wasn't worried about reaction to his Showtime special. "If they fire me from AGT for the things I've said, I can sue them and create a whole new controversy — 'NBC hates black people!'" he said with a laugh when asked if he was afraid the "AGT white money would dry up."

Cannon went on to praise the show and NBC, noting that "it's the best job that I have ... hopefully I can do it forever," adding that he was unsure how many more years he had left on his contract with NBC's summer hit.

However, as of Monday, Cannon had changed his tune.

"My soul won't allow me to be in business with corporations that attempt to frown on freedom of speech, censor artists, and question cultural choices. Not to get too detailed but this isn't the first time executives have attempted to 'put me in my place' for so-called unruly actions," he wrote in his post. "I will not stand for it. My moral principles will easily walk away from the millions of dollars they hang over my head.

"It's never been about the money for me, what is difficult to walk away from is the fans, the people who love me on the show. This hurts tremendously," he continued. "I felt like I was a part of the fabric of our great nation every summer, representing every culture, age, gender, and demographic. Now for the rug to be pulled from underneath me and to be publicly reprimanded and ridiculed over a joke about my own race is completely wrong and I have to do something about it."

Production on season 12 of America's Got Talent, which would have marked Cannon's eighth as host, is set to begin next month. The rest of the on-air team — judges Simon Cowell, Heidi Klum, Mel B and Howie Mandel — are set to return for the new season, which is expected to premiere sometime this summer.

"I wish AGT and NBC the best in its upcoming season but I can not see myself returning," Cannon wrote. "Most of us don't realize that there are 6 major corporations that control 90 percent of media in America and the amount of minority executives is dismal. With this being the case, true equality in our industry is impossible. There will always be a 'do as I say' mentality that mirrors society's perception of women and minorities, and only a few will stand up against it. I proudly stand as one of those few, and will gladly take on whatever repercussions that come with it."

NBC did not respond to repeated requests for comment.

Feb. 13, 11:30 a.m.: Updated with further comments from Cannon's special, and further comments from Howard Stern's interview with Cannon.