The Justice Department filed a judicial misconduct complaint on Wednesday against nearly all the federal judges in Minnesota, Attorney General Todd Blanche said, sharpening the Trump administration’s confrontation with the courts over immigration enforcement.

The complaint stems from a New York Times article in which six federal judges called the department’s failure to obey court orders during an immigration-enforcement surge a grave threat to the rule of law. Mr. Blanche said on Wednesday that their comments were “overtly political,” violated judicial rules and showed “an obvious bias” against the Department of Homeland Security.

“These judges talked to the media, or at least to the New York Times, about cases, some of which are ongoing, in a matter that the department views as a clear violation of their ethical duties,” Mr. Blanche said.

The complaint is pending before the federal appeals court that oversees Minnesota’s federal bench. While it is, Mr. Blanche wants the judges to step aside from cases involving the Department of Homeland Security. The complaint named the six active judges who spoke to The Times; a seventh active judge on the court did not take part in the article and was not named.

The demand may not get far. The bar for disqualifying a judge is high, and earlier efforts by the administration have gone nowhere, including a Justice Department lawsuit against the entire federal bench in Maryland over an order that limited how quickly the government could remove migrants who were contesting their deportations.

The filing is the latest in a series of tactics aimed at judges the administration sees as hostile to President Trump’s agenda. Top officials have called out judges by name over rulings they dislike, and judges around the country have warned that the public attacks have fed threats and intimidation against the courts.

The dispute also taps an open argument in the legal world over whether judges should criticize the administration outside a courtroom. Senator Chuck Grassley of Iowa and Representative Jim Jordan of Ohio, the Republican chairmen of the Senate and House Judiciary Committees, urged Chief Justice John G. Roberts Jr. to stop judges from talking to the press, particularly on condition of anonymity. The conduct committee of the Judicial Conference, the judiciary’s policy-making body, answered with softer guidance in February: an advisory said judges could, in “some circumstances,” offer a “measured defense of judicial colleagues from illegitimate forms of criticism and attacks that risk undermining judicial independence or the rule of law.”

Violence, intimidation, disinformation and threats to defy court orders all qualified as illegitimate, the advisory said, while instructing judges to weigh the “tone, context, and form” of anything they said, including in anonymous interviews. The judges quoted in The Times’s article spoke on the record; the article said the outlet interviewed seven judges in all.

One of them, Judge Nancy E. Brasel, whom Mr. Trump appointed in his first term, appeared to nod at the February guidance. “We are allowed to speak out about judicial independence,” she told The Times. “And so we should, in order to keep it.”