CNN said on Friday that it had cut ties with Reza Aslan, the Iranian-American scholar who is the host of the network’s weekly show “Believer,” after Mr. Aslan assailed President Trump in a series of vulgar messages on Twitter after the terrorist attack at London Bridge last weekend.

Mr. Aslan, whose program covered global religion and began this year, apologized after his tweets on Saturday, in which he described the president as “an embarrassment to humankind” and compared him, using profanity, to a piece of excrement.

His remarks came as Mr. Trump, in messages posted on Twitter minutes after the attack, criticized London’s mayor, Sadiq Khan, and argued that the episode justified the president’s proposal to restrict travel to the United States by people from several predominantly Muslim countries. Mr. Aslan wrote later that he “should have used better language to express my shock and frustration at the president’s lack of decorum and sympathy.”

“CNN has decided to not move forward with production on the acquired series ‘Believer with Reza Aslan,’” a spokeswoman for the network said in a statement on Friday. “We wish Reza and his production team all the best.” Mr. Aslan’s exit was reported earlier by Variety.

This is the second time in nine days that CNN has had to remove an on-air personality because of political commentary. Last week, the network said that the comedian Kathy Griffin would no longer be a host of its New Year’s Eve program after Ms. Griffin was rebuked for a posting a photograph online in which she brandished a fake severed head that appeared to resemble the president’s.

CNN’s parent company, Time Warner, has also faced a backlash at another of its units, HBO, after the host Bill Maher used a racial slur live on air during last week’s episode of his show “Real Time.” Mr. Maher apologized the next day.

“Believer” aired on Sunday evenings and had been scheduled to return for a second season.