Disney fired “Guardians of the Galaxy Vol. 3” writer-director James Gunn on Friday after several of his old tweets, in which he joked about topics such as rape and pedophilia, resurfaced online this week.

“The offensive attitudes and statements discovered on James’ Twitter feed are indefensible and inconsistent with our studio’s values, and we have severed our business relationship with him,” Walt Disney Studios Chairman Alan Horn said in a statement.

Several of the tweets, which dated to 2009, include jokes involving children and sexual misconduct.

Gunn was the writer and director of the previous two iterations of “Guardians of the Galaxy,” which were huge box-office hits for Disney and Marvel. The first movie, released in 2014, grossed $773 million worldwide. The follow-up in 2017 brought in $864 million. The third version was reportedly on track for a 2020 release. Gunn was scheduled to appear at San Diego Comic-Con on Friday evening before news of the firing broke.

Gunn has a history of making online comments that have stirred controversy. Several years before his first “Guardians of the Galaxy” film, he apologized for remarks in his blog that were called homophobic and sexist.

After Disney announced his ouster, Gunn apologized for the old tweets and said that “regardless of how much time has passed, I understand and accept the business decisions taken today.”

“My words of nearly a decade ago were, at the time, totally failed and unfortunate efforts to be provocative,” he said in a statement. “I have regretted them for many years since — not just because they were stupid, not at all funny, wildly insensitive, and certainly not provocative like I had hoped, but also because they don’t reflect the person I am today or have been for some time.”

He continued: “Even these many years later, I take full responsibility for the way I conducted myself then. All I can do now, beyond offering my sincere and heartfelt regret, is to be the best human being I can be: accepting, understanding, committed to equality, and far more thoughtful about my public statements and my obligations to our public discourse. To everyone inside my industry and beyond, I again offer my deepest apologies. Love to all.”

Disney is the parent company of ABC, which fired Roseanne Barr from her sitcom in May after a racist tweet.

Gunn is a vocal critic of President Trump and active social media user who often directs his ire at conservatives, and his tweets were resurfaced by celebrities in far-right Internet circles, such as Mike Cernovich and Jack Posobiec.

This tactic has become a mainstay of the pro-Trump Internet — finding and amplifying old, potentially offensive social media posts by perceived critics. In December, progressive talk-radio host and comedian Sam Seder was fired, and then rehired, as an MSNBC contributor after right-wing Twitter personalities recirculated a past offensive joke.

In Gunn’s case, the story was fueled by the volume of the writer-director’s offensive tweets, along with a conspiracy theory that is popular on the pro-Trump Internet that claims that Hollywood is part of a secret pedophile ring, along with Democrats.

Cernovich tweeted and retweeted Gunn’s old tweets dozens of times the day before Gunn’s ouster, encouraging his followers to spread them as widely as possible.

Cernovich has been one of the key amplifiers of fringe ideas to a much larger audience in recent years, wielding his Twitter account and 420,000 followers against his perceived enemies, especially liberals and the mainstream media.

Cernovich discussed Gunn’s tweets like an urgent breaking-news story, hopping on Periscope to live-stream his perusal through the director’s archives and asking his supporters to tell Disney about them. On his website, Cernovich posted the email address for Disney’s press team, to encourage his followers to contact them.

Gunn’s tweets quickly spread into more mainstream conservative circles, including the Daily Caller. After Gunn’s name started trending on Twitter, outlets such as Business Insider began to cover the controversy. Hours before Gunn was fired, Cernovich posted a video in which he displayed the by-then-deleted tweets on screen. It had been viewed 20,000 times by Friday afternoon.

Shortly after his firing, the pro-Trump Internet shifted its mission to implicating those it accused of covering for Gunn all along. “If you think that Disney didn’t do a background check on @JamesGunn before hiring him, think again,” tweeted William Craddick of Disobedient Media.

Cernovich tweeted a link to a story about Gunn that he didn’t like, accusing the media of “Going after me rather than working to fix Hollywood.”

Michael Cavna contributed to this report.