NBC was about done with Donald Trump even before he piped up about undocumented immigrants. Now it’s really, really done.

The real estate mogul and Republican presidential candidate lost a longtime business partner on Monday when NBC decided it had had enough of Trump. The network and its parent company, NBC Universal, said it was severing all business ties with Trump, a divorce sparked by Trump’s declaration earlier this month that those who enter the country illegally from Mexico are “rapists” and drug runners.

Trump has said plenty of things during his long association with the network to cause spittakes and heartache in NBC’s executive offices in Burbank and New York. His bizarre campaign as a “birther” in 2011, questioning President Obama’s origins and thus qualifications to be president, was a source of private embarrassment among some NBC executives, especially within the news division. At one point, MSNBC host Lawrence O’Donnell took to the air to call out his own parent company and to denounce Trump as “the most deranged egomaniac in the history of the NBC Entertainment division.”

On the other hand: The network has long profited from Trump’s extraordinary ability to attract attention to himself and to his NBC programs, the reality show “The Apprentice” and its successor, “Celebrity Apprentice.”

But this statement and its timing were different.

Republican presidential candidate Donald Trump’s long partnership with NBC is officially over. (Dominick Reuter/Reuters)

Trump’s assertion that Mexican immigrants are “bringing drugs, they’re bringing crime, they’re rapists, and some, I assume, are good people” brought swift condemnation from Latino organizations, a Mexican official and across social media.

After the Spanish language Univision network decided to drop the Trump-produced Miss USA and Miss Universe pageants last week, popular ire shifted to NBC, which co-owns the beauty contests with Trump. An online petition drive calling on NBC Universal to dump Trump had attracted about 200,000 people as of Monday.

NBC tried to cool the firestorm by issuing a statement disassociating itself from Trump’s comments last week. But NBC’s lawyers began reviewing stronger measures over the weekend, according to executives. That led to NBC Universal’s statement on Monday ending its association with Trump because of his “derogatory” comments.

NBC executives privately acknowledged the low stakes involved in their high-profile action. “Celebrity Apprentice” — owned by reality show titan Mark Burnett — was already set to continue next season without Trump, who opted out of the program when he decided to run for president.

The beauty pageants, meanwhile, have been so-so audience draws for NBC. The network consigned the 2014 Miss Universe contest to a Saturday night, typically the lowest-rated of the week, and drew just 3.75 million viewers, an all-time low. It did better airing on a Sunday night earlier this year (7.6 million viewers), but both the Miss Universe and Miss USA events have been losing popularity during the decade in which Trump and NBC have been partners.

Given NBC’s half-ownership of the Miss Universe program, its decision to sever ties with Trump leaves the annual contest in limbo. Miss USA was set to air on NBC on July 12. It could move to another network, but that would require Trump to buy out NBC Universal’s ownership — an unlikely scenario considering the short time frame. The next Miss Universe contest is scheduled for January. A pageant spokeswoman had no comment on Monday.

Trump responded to NBC Universal in contradictory fashion on Monday. He said in a statement that he might sue the company. On the other hand, during a speaking engagement, he said maybe he wouldn’t.

“They did not want me to run,” he said while speaking in Chicago. “They wanted me to do ‘The Apprentice.’ And now with my statements on immigration which happen to be correct, they are going to take a different stance and that’s okay. Whatever they want to do is okay with me.”

Earlier in the day, however, Trump’s office issued a statement saying it wasn’t okay: “If NBC is so weak and so foolish to not understand the serious illegal immigration problem in the United States, coupled with the horrendous and unfair trade deals we are making with Mexico, then their contract violating closure of Miss Universe/Miss USA will be determined in court,” it read.

Just for good measure, Trump took a shot at NBC for its decision to keep anchor Brian Williams after his suspension for exaggerating his reporting experiences.

“Furthermore, they will stand behind lying Brian Williams, but won’t stand behind people that tell it like it is, as unpleasant as that may be,” he said in the statement issued by his office.