NBC, Fox News and Facebook have pulled a controversial Trump campaign advertisement that CNN had previously refused to run after deeming it "racist."

NBC had aired the 30-second prime-time ad in the middle of a highly anticipated "Sunday Night Football" broadcast, but said on Monday that it would stop running it.

"After further review we recognize the insensitive nature of the ad and have decided to cease airing it across our properties as soon as possible," NBC Universal said in a statement.

Fox News reached a similar decision the day before, Marianne Gambelli, the network's president of ad sales, said in a statement Monday.

"Upon further review, Fox News pulled the ad yesterday and it will not appear on either Fox News Channel or Fox Business Network," she said.

The social media giant Facebook also said on Monday that it would remove the ad, which was shown to targeted groups of users in certain states, because it violates the company's advertising policy "against sensational content." Users may still share the video on their pages, Facebook said.

The ad, paid for by Donald J. Trump for President, stirred fear of a migrant caravan making its way through Mexico that is still hundreds of miles from the United States border. It tied Luis Bracamontes, an undocumented Mexican immigrant who was convicted of murdering two Sacramento sheriff's deputies in 2014, to the thousands of migrants who are fleeing Central America, even though Mr. Bracamontes is not known to be associated with the caravan.

"Dangerous illegal criminals like cop killer Luis Bracamontes don't care about our laws," the ad said.

It was a shorter version of an ad that the president shared on Twitter last week, which falsely claimed about Bracamontes that Democrats "let him into our country" and "let him stay." The network dedicated substantial editorial coverage to the longer ad, sometimes showing clips as anchors and chyrons declared it "racist."

The 30-second version run by NBC did not include the false claim about Democrats, but it still drew a direct connection from immigrants to crime, a tactic the president has repeatedly used. (Many studies have shown immigrants do not drive an increase in crime.)

NBC showed the ad during a marquee matchup between the New England Patriots and Green Bay Packers. NBC's decision to run the ad stood in stark contrast to CNN, which publicly responded when Donald Trump Jr. criticized the network for refusing to run it.

"CNN has made it abundantly clear in its editorial coverage that this ad is racist," the network's public relations account posted on Twitter. "When presented with an opportunity to be paid to take a version of this ad, we declined."

Debra Messing, an actress who plays Grace in NBC's "Will and Grace," protested the network's decision in a tweet addressed to her show's fans.

"I want you to know that I am ashamed that my network aired this disgusting racist ad," she wrote. "It is the antithesis of everything I personally believe in, and what, I believe, our show is all about."

Michael M. Grynbaum, Edmund Lee and Kevin Roose contributed reporting.