As presidential candidate, Donald Trump made being tough on what he called "radical Islamic terror" a central plank of his election bid. How has he responded to the first test of this nature since taking office?
In the immediate aftermath of the attack in New York on Tuesday evening, Donald Trump offered a measured reaction.
His White House released a statement offering "thoughts and prayers", praising first responders and pledging federal support for the ongoing investigation.
The president tweeted that that the perpetrator was a "very sick and deranged person" - the same words he used to describe the man who killed more than 50 people in Las Vegas a month ago.
There were hints of what was to come, however. He tweeted about not allowing "ISIS to return, or enter, our country", and another about stepping up his "extreme vetting" border security programme.
Then, on Wednesday morning, the dam broke. These are some interesting points about what followed.
The president lashed out against Democratic Senator Chuck Schumer - who represents the state where the attack took place - for supporting an immigration lottery system that gives residency to 50,000 applicants from nations that do not send many of their citizens to the US.
He called on Congress to end the Diversity Visa Lottery Program, calling it "a Chuck Schumer beauty", although the system was set up in 1990 law that was passed with broad bipartisan support and signed by Republican President George HW Bush.
As Republican Senator Jeff Flake pointed out on Twitter, Mr Schumer was among a bipartisan group who recently tried to change the programme as part of comprehensive immigration reform.
Mr Trump also tweeted that Mr Schumer was trying to "import Europes [sic] problems", which prompted a dry response from the senator.
"I guess it's not too soon to politicise a tragedy," he tweeted.
Trump supporters have been quick to throw the hypocrisy flag on their ideological counterparts as well.
"Still waiting for liberal calls for immigration bans/reform like they do every time there's a gun attack," Donald Trump Jr, the president's eldest son, tweeted. "Maybe hungover from Halloween?"
Since the president's criticisms, Mr Schumer has countered with his own policy recommendations - urging the president to back away from proposed budget cuts to anti-terrorism programmes.
"Our city relies on it to snuff out attacks," he tweeted.
It took less than 24 for hours for this latest incident to become drenched in politics.
A change of course
In the aftermath of the devastating hurricanes that hit the US earlier this year and the Las Vegas attack in September, the White House had cautioned that heated debates about politics and policy should be delayed.
"To have any kind of focus on the cause and effect of the storm; versus helping people, or actually facing the effect of the storm, is misplaced," Environmental Protection Agency head Scott Pruitt said in response to a question about climate change was Hurricane Irma headed toward the Florida coast.
"There will certainly be a time for that policy discussion to take place, but that's not the place that we're in at this moment" Press Secretary Sarah Huckabee Sanders said the day after the Nevada mass shooting, the largest in modern US history.
When asked why Mr Trump had suggested that his proposed travel ban was necessary shortly after the Orlando nightclub shooting in 2016, Sanders replied that "there's a difference between being a candidate and being the president".
When it came to the New York attack, however, President Trump followed the Orlando route.
Different attacks, a different response
The president's comments on Wednesday stands in marked contrast to his reaction to other domestic terror attacks that have occurred during his presidency.
After a white nationalist in Charlottesville drove a car into a crowd of counter-protesters, killing one, Mr Trump explained that he delayed commenting because "unlike other politicians", he wanted to make sure he knew all the facts before assigning blame.
"I don't want to go quickly and just make a statement for the sake of making a political statement," he said.
But the president's critics have pointed out his reticence when attacks involve perpetrators who are not Muslims.
He has not spoken at all about a man who was arrested on 6 October for trying to plant a nail bomb at an airport in Asheville, North Carolina. The suspect told police he wanted to "fight a war on US soil".
Mr Trump also held his tongue when another man was arrested on terrorism charges on 19 October for detonating a bomb in a parking lot in Williamsburg, Virginia.
For the president, it seems, the New York attack - like the Orlando mass shooting - merited a different response.
The Fox factor
So what changed between Tuesday night and Wednesday morning?
Mr Trump always seems to be at his most rambunctious on Twitter in the morning - in part because he likes to spend the time watching his favourite news programme, Fox & Friends.
On Wednesday the show featured guests - including former White House adviser Sebastian Gorka and retired Lt Colonel Tony Shaffer - who repeatedly laid the blame for the New York attacks on US immigration policies they said were backed by Mr Schumer and Democrats.
The president followed the show's lead. In two of his tweets, he included the Fox & Friends Twitter handle.
It has become a recurring occurrence during the Trump presidency. The Fox News morning show runs a segment on a controversial topic, and the president quickly fires off tweets on a similar theme.
Whether the subject is flag-burning, NFL protests, Confederate monuments, healthcare, immigration, Fox & Friends has become a window into the president's mind and a preview of tweets to come. Wednesday morning was only the latest example.