When an alleged Islamic State sympathizer drove a truck down a bike lane in Manhattan and killed eight people, it presented a test for Donald Trump: How would he respond to the first major terrorist attack in the U.S. of his presidency?

Mr. Trump began by expressing sympathy for the victims and vowing to keep out members of IS. But that is where he left the conventional responses behind.

The next day, he blamed a Democratic senator for his role in starting the visa program used by the suspect to enter the country. He described the American justice system as a "joke" and suggested he might send the attacker to a military prison in Guantanamo Bay. Twice this week he tweeted that the suspect, an Uzbek immigrant, should get the "DEATH PENALTY" in capital letters.

Story continues below advertisement

Related: Trump links New York terrorist attack to immigration, calls for death penalty

Mr. Trump's statements and tweets this week reveal a President who is unconcerned with the norms that once governed presidential behaviour and who chafes at the traditions that have defined a president's relationship with law-enforcement authorities for decades.

In his first televised remarks on the New York attack – the deadliest to hit the city since Sept. 11, 2001 – Mr. Trump briefly expressed condolences and then made extended remarks criticizing U.S. immigration policy. What's more, he called for "far quicker and far greater" punishment for terrorists, saying that the current system of administering justice is a "joke" and a "laughingstock."

The sight of the President, less than 24 hours after a terrorist attack, impugning the U.S. legal system was too much for some in New York. "I get to work with our justice system every day," the city's police commissioner, James O'Neill, said in a television interview. "It's definitely not a joke." Preet Bharara, formerly the top federal prosecutor in Manhattan, commented on the laughingstock remark by noting that "The feeling may be mutual."

Story continues below advertisement

Mr. Trump raised more hackles in the law-enforcement community with his suggestion that the suspect in the attack, Sayfulla Saipov, be transferred to the prison in Guantanamo Bay. Such a transfer would be unprecedented and raise a host of thorny legal questions: no permanent resident of the U.S. has ever been taken from the country to the Cuban prison, noted Joshua Geltzer, a law professor at Georgetown University.

U.S. federal courts, meanwhile, have conducted a string of successful terrorism prosecutions in recent years. Mr. Saipov's case is one that the U.S. Federal Bureau of Investigation and Justice Department are "well-placed to handle effectively," Prof. Geltzer said. He added that it was encouraging that Mr. Trump dropped the idea of sending Mr. Saipov to Guantanamo Bay a day after floating it.

Meanwhile, by repeatedly calling for Mr. Saipov to be executed, Mr. Trump has complicated the work ahead for federal prosecutors. His tweets can be cited by defence counsel as prejudicing potential jurors and as evidence of possible political tampering with the sentencing process.

Mr. Trump's outspoken comments on the work of the judicial system represent a rupture with past precedent. For Mr. Trump, however, it is part of a pattern. He called for his election opponent, Hillary Clinton, to be imprisoned, and since becoming President has made harsh criticisms of court decisions. He appears uninterested in maintaining the traditional independence of the Justice Department, which has long sought to prevent political interference in its decision-making.

Story continues below advertisement

Mr. Trump has also repeatedly expressed his fury with the ongoing investigation into possible links between his campaign and the Russian effort to influence the election. In May, Mr. Trump fired FBI director James Comey, partly out of irritation with the probe.

On Thursday, Mr. Trump told a radio host that "the saddest thing" is that he is not supposed to be involved in the work of the FBI or the Justice Department. "I am very frustrated by it."

For some of Mr. Trump's supporters, his unconventional approach to the presidency is refreshing, but a majority of Americans disapprove of his performance, with some seeing ample cause for alarm. "It's pretty clear that he would like to govern as an authoritarian unlimited by the rule of law," said Chris Edelson, an expert on the presidency and national security at American University in Washington. "Whether he will be able to do so is another question."

One expert said that in the wake of the attack in New York, he feared that Mr. Trump might seek to implement more drastic changes to the immigration system. Based on his pre-election rhetoric, "I thought he might target, say, all Muslims who are immigrants," said Alex Nowrasteh, an immigration policy analyst at the Cato Institute, a libertarian think tank in Washington.

Story continues below advertisement

Instead, Mr. Trump called for the elimination of the Diversity Visa Immigrant Program, a lottery through which Mr. Saipov entered the U.S. in 2010 and an end to the ability of immigrants to sponsor their family members. Mr. Nowrasteh noted that more than 9 million people apply for the diversity visa lottery each year for only 50,000 spots and those selected go through the normal vetting process, making it an ineffective way for would-be terrorists to enter the country. Mr. Saipov, meanwhile, appears to have embraced violent extremism years after his arrival in the U.S.