Disney CEO Bob Iger has made his position clear: Canceling the hit ABC series "Roseanne" was the "right thing."

The company's top executive tweeted his thoughts Tuesday afternoon shortly after the network announced it would drop the show. The decision came hours after Roseanne Barr, the star of the show, went on a racist Twitter rant.

"There was only one thing to do here, and that was the right thing," Iger tweeted. ABC is one division of the film, TV and theme park empire.

In his tweet, Iger also included a statement released earlier Tuesday by Channing Dungey, the president of ABC Entertainment.

"Roseanne's Twitter statement is abhorrent, repugnant and inconsistent with our values, and we have decided to cancel her show," Dungey said.

From Channing Dungey, President of ABC Entertainment: "Roseanne's Twitter statement is abhorrent, repugnant and inconsistent with our values, and we have decided to cancel her show."

There was only one thing to do here, and that was the right thing. — Robert Iger (@RobertIger) May 29, 2018

Related: ABC cancels 'Roseanne' after star's racist Twitter rant

Barr has been attacking prominent Democrats this week. In one of her tweets, she wrote, "Muslim brotherhood & planet of the apes had a baby=vj."

Barr was responding to a comment about Valerie Jarrett, a top former aide to President Barack Obama. She replied to CNN reporter Andrew Kaczynski and said it was "a joke." She later deleted the tweet and tweeted an apology to Jarrett and "all Americans."

The cancellation stunned Hollywood — "Roseanne" has been one of ABC's biggest hits.

But Barr's tweets also represented views that were at odds with the kind of message Disney and Iger have been sending.

This is, after all, the same company that released "Black Panther," a Marvel superhero film that shattered the norms of black representation in Hollywood.

Another recent film, "A Wrinkle in Time," marked the first time a woman of color — Ava DuVernay — directed a $100 million live-action movie. (After the "Roseanne" cancellation, DuVernay tweeted that Disney was "stepping up and doing the right thing here.")

Iger has played a vocal role in championing diversity, too. Earlier this year, he told Vogue that he "felt that Marvel needed to turn its afterburners on in terms of developing movies based on more diverse characters."

"It was time to take a leap forward, and I exhorted them to do that," he told Vogue.

Another issue: While Barr had long been a controversial figure in the industry, her use of social media this time around just became too much to ignore.

While "Roseanne" was clearly a hit for ABC and Disney, the risks were also no secret, said Gregory Unruh, an associate professor at George Mason University who studies sustainable business strategy and social innovation. He noted that Iger was long familiar with Barr — the original run of the show coincided with his tenure as a top executive at ABC.

"There is no way to argue the company didn't know that Roseanne was abrasive and hard to work with," Unruh said. "Employee turnover at the original series was legendary with one executive producer comparing the work environment to war-torn Beirut."

This time, though, is different. Unruh said Barr can broadcast "abuse" directly because of Twitter.

"Where her toxic views leaked out as rumor back in the 1990s, today they are laid out for everyone to see instantaneously," he added. "She is damaging to the brand and image of Disney."

-- CNNMoney's Frank Pallotta and Brian Stelter contributed to this report.