In the wake of a deadly attack in New York City, President Trump is pointing the finger, playing fast and loose with the facts, repeating theories from right-wing media and saying things that gin up his base. And he's doing it all on Twitter.

In tweets Tuesday night and Wednesday morning, Trump confirmed a pattern about how he handles moments of crisis: Find the angle that fits his political narratives. Let's break down how he did that with this particular attack.

1. He watches cable news and comments on it

On Wednesday morning, Trump quoted guests who appeared on “Fox and Friends” rather than sharing what he learned, say, in top-level security briefings with people who have access to the latest intelligence.

On a near-weekly basis, Trump repeats ideas and seizes on comments that cable news — especially Fox — is discussing. Just Monday, Trump was apparently watching “Fox and Friends” and live tweeting what he saw there minutes before a political crisis broke for him: that his former campaign chairman had been indicted on financial crime charges.

2. He jumps out ahead of the publicly stated facts to come to a conclusion.

Trump has arrived at two conclusions about this attack that aren't yet supported by publicly known facts: That the attacker has ties to the Islamic State, and that he came to the United States via a visa program. It's likely the president knows more information than we do.

But investigators in New York tell The Washington Post that they're still looking into how this man got to the United States and why he drove a truck into people. Was this an Islamic State-inspired attack, or was he acting as part of a broader plot?

This isn't the first time Trump has gotten ahead of the facts. Hours after a bomb detonated on a London train in September, Trump called it a terrorist attack. London police told CNN that was “pure speculation” — and that such speculation was “unhelpful.”

3. He comes to a conclusion that is politically beneficial to him.

Trump seemed to perk up while watching “Fox and Friends.” There's a possibility this man came to the United States on a visa program? One championed by Democrats? That fits neatly into Trump's agenda. He wants to make it much more difficult for immigrants to come to the United States. He also supports a bill in Congress that dramatically revamps the current U.S. immigration system to cut legal immigration in half and base visa entries on merit rather than need.

As The Post's Philip Bump has pointed out, there's a notable disparity in how Trump responds to attacks by Muslims and on Muslims or his political opponents. For the former, he's quick to jump to conclusions. Politically, that's helpful for Trump: He's fighting to instate a travel ban that targets mostly majority-Muslim countries. (Although Uzbekistan, where police believe the attacker is from, has never been on the list.) On the latter — attacks targeting Muslims or his political opponents — he has waited days to respond.

4. He seeks to cast blame elsewhere.

Trump staked his candidacy and presidency on keeping America safe. A deadly terrorist attack under his watch isn't helpful to that narrative. It's much easier to blame a visa program Congress passed two decades ago for letting this guy in.

Trump casts blame when under pressure. After a white supremacist supporter drove his car into a crowd of counterprotesters in Charlottesville, Trump blamed “both sides” for the violence. After Republicans failed to repeal Obamacare, Trump blamed Republicans. After four U.S. soldiers died in Niger under questionable circumstances in October, Trump appeared to put the attack on “my generals.”

On Wednesday morning, Senate Minority Leader Charles E. Schumer (D-N.Y.) responded to Trump zeroing in on him after the attack: “President Trump, instead of politicizing and dividing America, which he always seems to do at times of national tragedy, should be focusing on the real solution — anti-terrorism funding — which he proposed cutting in his most recent budget.”

5. He plucks theories directly from right-wing media and states them as fact.

As The Post's Derek Hawkins and Samantha Schmidt report, some right-wing media jumped on a local ABC story that the attacker came to the United States from a diversity lottery visa program and connected some dubious dots to misstate who was responsible for it. Schumer did help conceive of that visa program, but it got rolled into a larger immigration package that Republicans supported and a Republican president signed. And as Trump critic Sen. Jeff Flake (R-Ariz.) points out, Schumer supported getting rid of the visa program several years ago.

This is far from the first time Trump has leaned on the far right for his facts or to prove a point. After Charlottesville, Trump retweeted an alt-right conspiracy theorist asking where the media “outrage” was on gun violence in Chicago.

And probably his most infamous unproven claim is that President Barack Obama wiretapped his campaign. The claim appeared to have its roots in an article on conservative blog Breitbart, which is owned by Trump's former chief strategist, Stephen K. Bannon.

6. He says stuff that gins up his base.

It's likely not a coincidence Trump has seized on a visa program with “diversity” in the name as the culprit of this attack. “Diversity” is a word that sets off alarm bells for some on the right, who view it as a politically correct code word for allowing other people to take jobs, change the demographics of their community, etc. It seems to have worked. As Hawkins and Schmidt also report:

By early Wednesday morning, “Diversity Visa” was trending on Twitter, appearing in more than 53,000 tweets. Some users shared graphic illustrations of a pair of hands with blood dripping from them. “You have blood on your hands Chuck,” one tweet read.

From casting Mexican immigrants as rapists and criminals, to refusing to unequivocally denounce white supremacists, to peddling a birther conspiracy theory about Obama, Trump has long stoked this side of some of his supporters.