The Justice Department will order all of its civil division lawyers to take an hourlong remedial ethics class, hoping to head off even worse punishment from a federal judge who is furious about the way Obama administration attorneys misled him in the case involving the president’s deportation amnesty.

In a document filed with Judge Andrew Hanen last month and made public Monday, administration attorneys insisted they didn’t mean to mislead the court, but they acknowledged sloppiness and said their own use of technical jargon may have confused the judge.

But the lawyers pleaded with Judge Hanen not to slap any of them with sanctions, saying the errors were the result of groupthink and not attributable to any particular lawyer’s goofs. The lawyers asked the judge to keep in place the 108,000 three-year amnesties issued in defiance of his rulings, saying to punish the illegal immigrants who were improperly granted them “would be unwarranted.”

“We fully recognize that we used flawed phrasing, which is unfortunate and regrettable, and — quite understandably — has been exasperating for this Court. But the imprecision was inadvertent, not the product of an intent to deceive,” the department said in its filing. “We therefore respectfully submit there is no basis for imposing sanctions against any person or entity.”

Benjamin C. Mizer, principal deputy assistant attorney general for the civil division, issued an apology in a separate filing and said he would require the remedial ethics classes.

“On behalf of the Civil Division and the Department of Justice, I apologize to the court for the problems that arose in this case. I am very sorry and deeply regret that we failed to provide clear and precise information to the court,” he wrote.

The case stems from Mr. Obama’s November 2014 executive actions on immigration.

One of those actions was to expand his 2012 deportation amnesty, which granted young adult illegal immigrant Dreamers two-year work permits and stays of deportation. Under the expansion, the work permits and stays of deportation would last three years and would apply to millions of illegal immigrant parents, not just to Dreamers.

Although most of the expansion was to begin in February 2015, the three-year permits were granted immediately to Dreamers already in line for two-year permits as of November.

Texas led 25 other states in suing to stop the expanded amnesty, and government attorneys during the case repeatedly told Judge Hanen that none of the expanded program was in effect.

In February, just days before the expanded amnesty was due to accept its first applications, Judge Hanen halted the entire program, ruling that Mr. Obama likely broke federal law. Weeks later, the Justice Department approached the judge and said it had been processing the three-year applications for Dreamers all along — and 108,000 had already been approved.

Judge Hanen’s ruling on the illegality of the amnesty was upheld by an appeals court, which likewise ruled that Mr. Obama likely broke the law. That ruling rose all the way to the Supreme Court, which deadlocked 4-4 in June, leaving the lower-court decisions in place.

But even as the big legal questions were being settled above him, Judge Hanen demanded answers from the administration over how and why it misled him. Earlier this year, he issued a stinging rebuke, saying he felt the government attorneys mishandled the case.

“There is no doubt that misconduct has occurred,” he wrote in a May 19 order.

In searching for a punishment, he said he thought about making the government pay the plaintiffs’ legal costs but said that would just put federal taxpayers on the hook to send money to the states — a shell game of taxpayers’ money.

Instead, he ordered the Justice Department to put lawyers at its Washington headquarters through remedial ethics training. He also barred some Washington-based lawyers from practicing in his court.

Weeks later, after a hearing, Judge Hanen stayed his punishment but ordered the Justice Department to suggest its own penalties — including what should happen to the 108,000 illegal immigrant Dreamers who were wrongly granted three-year amnesties.

Justice Department lawyers said they thought the judge knew about the three-year approvals because it had been part of their public announcements, including on Homeland Security Department websites. They also said the states that challenged the amnesty never challenged the Dreamer amnesty, just the expansion.

Still, Mr. Mizer said he would impose the ethics training on his employees to try to make up for the bungle.

“In light of the events in this case … I have asked an outside expert in attorney ethics and professional responsibility to provide special one-hour training of his design for Civil Division attorneys,” he said. He said he would take the class along with his employees.

He also said the federal government could be ordered to pay attorneys’ fees to the states, but he balked at further penalties such as sanctioning individual lawyers for their misbehavior, saying there was no evidence of “bad faith” from the attorneys.

The Justice Department also said it wouldn’t revoke the 108,000 three-year amnesties already approved for Dreamers, saying the states that sued haven’t shown any harm to them from having the three-year permits remain in effect.

The case has been a problem for the administration from the start. Even after Judge Hanen’s February 2015 order halting the program, Homeland Security continued to send out three-year approvals.

Immigration officials had to scramble to track those down and cancel the three-year permits, replacing them with two-year permits instead.

The most recent set of three approvals was not discovered until May — some 15 months after Judge Hanen’s initial halt and just days after the judge delivered one of his rebukes to the government attorneys.