Acting U.S. Attorney Joon H. Kim, of the Southern District of New York, announces federal terrorism charges against Sayfullo Saipov, in New York, Nov. 1. (Lane/Epa-Efe/Rex/Shutterstock)

With an off-the-cuff remark to reporters, President Trump seemed to throw into doubt the federal prosecution of the suspect accused of killing eight people this week with a rental truck — the most lethal terrorist attack in New York City since 2001. Then, nearly as quickly, he reversed course about sending Sayfullo Saipov to Guantanamo Bay, Cuba, and heartily endorsed putting him on trial in New York federal court, followed by his execution.

The whipsaw declarations in less than 24 hours suggested major policy swings on national security matters of life and death, but the Justice Department appears to increasingly be doing the once-unthinkable: tuning out the president of the United States.

And in some proceedings, including over Trump’s travel ban orders, government lawyers have argued that informal statements, including by the president, “may not accurately reflect the government’s position.”

Others, however, may be tuning in. Defense attorneys could well seize on the president’s comments to either try to avoid capital punishment for their client or have the case moved to a different jurisdiction because of pretrial publicity.

Authorities say Saipov drove a rental truck down a bike path on the west side of Manhattan on Tuesday, killing eight people and injuring 12. When questioned by investigators, Saipov confessed and said he was inspired by the Islamic State to carry out the attack, according to a criminal complaint filed against him.

Twenty-nine-year-old Sayfullo Saipov is the suspect held in the terrorist attack that left eight people dead in Lower Manhattan on Oct. 31. Here’s what you should know. (Amber Ferguson/The Washington Post)

The day after the attack, Trump called the criminal justice system a “joke’’ and “a laughingstock.’’ He said that the United States needs a system of punishment “that’s far quicker and far greater than the punishment these animals are getting right now. They’ll go through court for years. . . . We need quick justice, and we need strong justice.”

When a reporter asked the president Wednesday at about noon whether Saipov should be sent to the U.S. detention facility at Guantanamo Bay, Trump replied, “I would certainly consider that, yes. Send him to Gitmo. I would certainly consider that.”

A few hours later, White House spokeswoman Sarah Huckabee Sanders seemed to buttress that argument, referring to Saipov as an “enemy combatant’’ — a term freighted with potential legal consequences, including possible imprisonment at Guantanamo or some other military facility.

Trump’s public statements intensified concerns among federal law enforcement officials, civil rights advocates and some lawmakers that the Trump administration might try to short-circuit the prosecution of Saipov and have him transferred into military custody.

As the president was talking, FBI agents and Justice Department prosecutors were preparing criminal charges based in large part on what was said to be the suspect’s lengthy hospital room confession.

Hours after Trump’s statements, U.S. Attorney Joon H. Kim in New York announced the charges against the suspect. While Kim made no explicit reference to the president’s comment, he did mention a number of recent terrorism cases successfully prosecuted by his office.

President Trump speaks during a meeting on tax policy with Republican lawmakers in the White House, Nov. 2. (Jabin Botsford/The Washington Post)

On Thursday morning, Trump swung back hard in the opposite direction — supporting a federal trial in New York for Saipov — by tweeting that he would “love to send the NYC terrorist to Guantanamo but statistically that process takes much longer than going through the Federal system . . . . . . There is also something appropriate about keeping him in the home of the horrible crime he committed. Should move fast. DEATH PENALTY!’’

Prosecutors have not indicated whether they will seek the death penalty against Saipov. A Justice Department spokeswoman declined to comment on the president’s remarks.

In the federal system, deciding whether to seek capital punishment against a defendant is a complex process that takes months. It begins with a recommendation from the U.S. attorney’s office, which is then reviewed by the attorney general before a final decision is made.

An attorney for Saipov declined to comment Thursday on Trump’s statements.

Mary McCord, a former senior national security official at the Justice Department, said that “tweets and off-the-cuff statements make the jobs of career Justice Department people challenging. . . . Obviously, prosecutors don’t like to see people in positions of authority — including the president — commenting on possible penalties.’’

But, she said, prosecutors “during this administration, or previous administrations, are used to blocking out statements and just doing their jobs.’’

In multiple cases, Trump’s Justice Department has taken the position that Trump’s own utterances are irrelevant to government policy.

In a number of instances, Justice Department lawyers have tried to distance themselves from Trump’s pronouncements. In arguments over the administration’s various travel bans, they gave argued that comments by the president and his advisers should not be considered because, in the department’s view, the courts should not look beyond official statements and the order itself to determine its purpose.

And in one case, Justice Department lawyers contended that even official pronouncements from the White House were not, in fact, official.

In a lawsuit over the administration’s attempt to yank funding from “sanctuary cities,’’ Justice Department lawyers argued that even the president’s executive order isn’t a new policy but rather a type of “bully pulpit’’ exhortation meant to highlight a new approach to immigration enforcement.

As much as government lawyers try to ignore the president’s more problematic remarks, they could already be affecting the outcome of one high-profile case: that of Army Sgt. Bowe Bergdahl, who has pleaded guilty to desertion and misbehavior before the enemy. He is awaiting sentencing for leaving his post in Afghanistan in 2009. Bergdahl was captured and held by the Taliban for years before being returned to the United States as part of a prisoner exchange.

Earlier this week, the military judge overseeing his case, Col. Jeffrey R. Nance, said he may lighten Bergdahl’s sentence because of harsh comments made about the soldier by Trump. “I will consider the president’s comments as mitigation evidence as I arrive at an appropriate sentence,’’ Nance said.