On Tuesday, President Trump lashed out at House Democrats after they unveiled two articles of impeachment against him, tweeting “WITCH HUNT!” in all caps and slamming the House Intelligence Committee chairman, Rep. Adam B. Schiff (D-Calif.), as “a totally corrupt politician.”

But as Trump raged, his campaign appeared to be busy thinking of a way to leverage the historic announcement — a milestone for Democrats leading the impeachment process — in the president’s favor. And by Tuesday afternoon, they had come up with an idea.

A 21-second video shared by the Trump War Room Twitter account featured the dramatic scene from Marvel’s “Avengers: Endgame” in which supervillain Thanos is about to carry out his mission of wiping out half of all life in the universe — only the clip had been edited. Trump’s face is superimposed on Thanos, and when the character snaps his fingers, a group of Democratic leaders, including Schiff and House Speaker Nancy Pelosi (D-Calif.), are turned to dust.

“House Democrats can push their sham impeachment all they want,” the campaign tweeted. “President Trump’s re-election is inevitable.”

The short video instantly triggered a flood of reactions. Many mocked the campaign for portraying Trump as a supervillain who is infamous for being a “genocidal warlord,” and questioned whether the president’s reelection team had even watched the 2019 film, pointing out that the scene comes moments before Thanos realizes the Avengers outsmarted him. The altered clip even prompted a scathing response from Thanos co-creator, comic book writer and artist Jim Starlin.

“After my initial feeling of being violated, seeing that pompous dang fool using my creation to stroke his infantile ego, it finally struck me that the leader of my country and the free world actually enjoys comparing himself to a mass murderer. How sick is that?” Starlin wrote in a post shared to Instagram. “These are sad and strange times we are going through. Fortunately all things, even national nightmares, eventually come to an end.”

Matt Wolking, the campaign’s deputy communications director, hit back at critics for lacking a sense of humor.

“The Trump Campaign is grateful to every bitter, humorless liberal who helped share our post poking fun at Democrats’ pointless impeachment sham,” Wolking told The Washington Post in a text message late Tuesday, encouraging the president’s supporters to subscribe to a texting service for updates on his reelection effort. (Similar instructions are displayed in a graphic on Tuesday’s video.)

House Democrats unveiled two articles of impeachment against President Trump Dec. 10, charging him with abuse of power and obstruction of Congress. (The Washington Post)

In the video, tense instrumental music crescendos as the Trump-Thanos figure, wearing the all-powerful Infinity Gauntlet, prepares to snap his fingers and eliminate half of existence.

“I am inevitable,” Thanos’s gravelly voice can be heard saying. A loud snap rings out, and the video cuts to footage of Democrats announcing the impeachment articles against Trump at a news conference Tuesday.

Pelosi is abruptly cut off when she and other Democratic leaders vanish into a cloud of dark particles, leaving behind an empty lectern.

By early Wednesday, “Thanos” was trending, with roughly 56,000 mentions, and the video had been watched more than 3 million times.

Many viewers were perplexed with the Trump campaign’s decision to highlight that scene.

“Did you watch the movie???” Bloomberg reporter Ryan Teague Beckwith tweeted.

“Y’all didn’t see the end of that movie, did y’all?” another person asked.

The film’s actual events go something like this: Thanos snaps and quickly realizes something is very wrong — the Infinity Stones needed to power the gauntlet have been stolen by Iron Man. The superhero then utters his famous line, “And I am Iron Man,” and uses the stones to disintegrate Thanos and his army.

Critics rushed to call attention to the pivotal plot point.

Others noted that presenting Trump as a supervillain might not have been the best strategy.

“There’s several levels of fail here,” a Twitter user wrote. “1: You’re comparing Trump to a genocidal warlord. 2: That same warlord killed half the universe, tortured one daughter, and murdered the others. 3: This is the scene where Thanos realizes he’s been tricked and defeated.”

The Thanos video marks the latest instance that an attempt to riff on pop culture has not gone smoothly for Trump, who has previously made references to the hit HBO show “Game of Thrones” and the 2012 film “The Dark Knight Rises.”

In January, the president was derided after he shared a meme that said, “The wall is coming,” inspired by the “Game of Thrones” tagline, “Winter is coming.” The words, stylized in the same font used by the show, were written across a picture of a steely eyed Trump looming over what appeared to be a version of the border wall. “Game of Thrones” fans didn’t hesitate to inform the president, who had probably not seen the award-winning show, that the great Wall in Westeros was destroyed during the Season 7 finale.

Several months later, Trump ran into another hurdle when he posted a video featuring music from Christopher Nolan’s “The Dark Knight Rises.” The clip was promptly taken off social media after Warner Bros., the studio behind the movie, made a copyright claim.

On Tuesday, as critics continued to ridicule the Avengers-themed video, some viewers leaned into the portrayal of Trump.

“So Trump is Thanos and the Democrats are the Avengers trying to restore democracy that evil Republicans have nearly destroyed,” one person tweeted. “Glad we’re on the same page.”