Director James Gunn at a screening last year of "Guardians of the Galaxy Vol. 2" in London. (Daniel Leal-Olivas/AFP/Getty Images)
Media columnist

Let’s say this up front. Writer-director James Gunn wrote some appalling things on Twitter years ago.

His jokes about rape and sex with children not only cross the decency line, they continue to run for another couple of miles at full speed.

It’s not hard to understand why Disney — with its vast, rich empire resting on a foundation of wholesomeness and family friendliness — cut him loose late last week, despite his monumental success at the helm of Marvel’s “Guardians of the Galaxy” movies. (The first two grossed $1.6 billion; the third was due to start production this fall.)

The casual observer might be inclined to say good riddance to a guy who could respond to the hashtag #unromanticmovies with the suggestion: “Three Men and a Baby They Had Sex With” or come up with this tweet: “The best thing about being raped is when you’re done being raped and it’s like ‘whew this feels great, not being raped!’ ”

I can’t defend those writings and don’t want to.

Neither can Gunn, 51, who for years has regretted them and reasonably makes the case that he’s grown into a person who recognizes how atrocious they were, even if part of a comedic tradition that relies on shock and provocation.

“My words of nearly a decade ago were, at the time, totally failed and unfortunate efforts to be provocative,” Gunn said in a statement last week about tweets mostly from 2008 to 2011.

“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.”

But Disney executives should have known what they were getting with Gunn, who was a different kind of filmmaker a decade ago, directing the comedy-horror picture “Slither”and a Web-series spoof called “James Gunn’s PG Porn.”

What caused the firing had very little to do with Gunn’s background and everything to do with the way the far-right dirt-diggers — “cyber nazis,” as they’re known — are able to use the Internet with the express purpose of ruining people’s lives.

Everything about it shouts “bad faith.”

“All of the outrage is completely feigned to weaponize outrage,” said Andrew Todd, who writes about gaming and film for the website BirthMoviesDeath.com.

He told me that he sees a clear link between Gunn’s firing and the 2014 controversy known as Gamergate in which online mobs viciously attacked female video game designers.

It is, he said, a clearly established pattern that has its own playbooks involving digging up old material, taking it out of context, contacting the victim’s employer and often using right-wing media and politicians to reach the end goal: career destruction.

In the case of Gunn, for example, Breitbart News and Sen. Ted Cruz (R-Tex.) were along for the ride, with Cruz featured in a “news” headline calling for the director’s criminal prosecution. And at the center of things was the detestable Mike Cernovich, whose photo should flash every time the words “far-right troll” are used.

Let’s recall that some members of this crowd were behind the infamous Pizzagate episode, which resulted in a Washington restaurant, Comet Ping Pong, being targeted by a gunman looking for the location of Hillary Clinton’s supposed child-sex ring.

Much of the news media and most of polite society have little understanding of how these bad-faith attacks work. What is dug up is too often taken at face value, without crucial context about how tweets and other forms of expression are being turned into bludgeons in a cynical war against liberal values and individuals.

The question arises, then: What should Disney have done, given the outrage that was being fanned into a raging fire?

Plenty. Disney could have decided to back its creative talent, even censure him in some way, and explain just what was happening.

Corporate honchos could have said how reprehensible they found the tweets to be and made the point that artistic people experiment and grow in their development.

Onlookers are quick to compare this case to that of Roseanne Barr being fired for her racist tweet about Valerie Jarrett. It’s a flawed comparison: That wasn’t a decade old but from the present moment, showing that Barr — far from evolving — was the same old racist she always was.

And some are quick to compare the Gunn situation to the firings and demotions of the #MeToo movement. Again: The comparison doesn’t hold up well.

Gunn made disgusting jokes on the Internet. He didn’t harass people or use his power to demand sexual favors.

In short, you can’t defend James Gunn’s tweets, and it’s hard to defend him.

But in an era of escalating bad-faith attacks, it’s much worse to reward the mob with a scalp.

For more by Margaret Sullivan visit wapo.st/sullivan