The Trump administration’s explanation for why it wants to put a citizenship question on the U.S. census was “contrived,” Chief Justice John G. Roberts Jr. wrote in late June, voting with the four liberals on the Supreme Court. That is a polite way of saying that the stated rationale — that the question would help the government enforce the Voting Rights Act — was a lie.

After that decision, government lawyers at first told both the opposing counsel and the courts that the Census Bureau was ready to give up, ending the effort to add the controversial question. But on the president’s orders, the Department of Justice reversed course and announced it would try to present a lawful reason that the court would accept — a tall order, given ample documentation that the question was intended from the start to give an electoral advantage to white Republicans and the court’s warning against presenting disingenuous justifications.

Then something strange happened: The DOJ asked the courts to allow all the lawyers on its team to withdraw from the case, to be replaced by a new set of government attorneys. The motion to withdraw led to widespread speculation among legal observers — as yet unproved — that the original team was unwilling to help make up a new excuse for the law. “There is no reason they would be taken off that case unless they saw what was coming down the road and said, ‘I won’t sign my name to that,’” Justin Levitt, who was a senior official in the Justice Department in the Obama administration, told the New York Times. (On Tuesday, one judge denied most of the requests, but gave the attorneys an opportunity to try again, if they explained their reasons more fully.)

The lawyers certainly would have been justified in requesting to withdraw on ethical grounds. And so the episode makes clear the precarious position that career DOJ attorneys occupy in the Trump administration — raising the question whether the rules of professional responsibility allow them to defend the indefensible.

These lawyers were already on an ethically slippery slope. Up to a point, they were willing to defend the government’s census policy, one widely understood to work to depress the counting of Latino residents and so diminish federal funding and political representation for their communities. But being asked to make up a second bogus excuse may have been a bridge too far for the original census team. The lawyers must also explain why they repeatedly told the courts that June 30 was the final deadline to finalize the census, which led the judiciary to accelerate the case — and why they now say they have more time.

Legal ethics differ from normal human ethics — the kind of moral compass that keeps you from stealing from babies and cutting in line — in important ways. Medical doctors take an oath to “do no harm.” The legal profession, in contrast, is built on a shared norm that there is no shame in helping your client do a great deal of harm so long as you stick to a narrow set of professional rules.

Represent your client’s interests as best you can. Don’t steal from your client, sleep with him or help him commit a future crime. Don’t lie to the court. Don’t make obviously frivolous arguments (though you can get pretty close). An attorney who breaks those rules may be sanctioned by the bar, or even have the license to practice law revoked. But so long as she stays within these lines, she will face no professional sanctions, and, at least among her lawyer friends, few social ones either, even if her work makes the world a worse place.

There are often reasons not to condemn a lawyer based on the choice of client: People charged with serious crimes have a constitutional right to an attorney, even if they are guilty. But the ethical duty to serve those vulnerable to state power does not extend to advocacy for government abuses.

We are too hesitant to judge lawyers who employ their considerable talents in service of the horrific agendas of the Trump administration. I graduated from law school a few months before the 2016 election, and it has been distressing to watch my classmates join prestigious offices in the Justice Department, where their job is to defend the president’s agenda.

It is often said in D.C. legal circles that the crux of those offices’ work is apolitical: They guard the power of the executive branch generally, regardless of the agenda of the person in the White House. But this administration’s priorities mean that these lawyers work to defend — and to sanitize — Trump and his Cabinet’s xenophobia and lawlessness. Most of these line attorneys, especially at the junior level, are in no position to shape the White House’s agenda for the better, although they may justify their continued employment on that basis. Instead, they construct seemingly reasonable rationales for reprehensible policies such as the Muslim ban or the border wall. As a result of their talents, these policies are more likely to pass judicial muster.

The neutrality of the professional rules provide these lawyers cover: Technically, a DOJ attorney has done a great job as a lawyer — if not as a human — when she vigorously defends her client’s policy of turning away asylum seekers at the border or shutting down family-planning clinics.

But now, the administration’s legal positions have grown so unreasonable that the professional rules may finally provide a check. As Georgetown law professor Marty Lederman put it on Twitter, devising “contrived” legal arguments, as the DOJ lawyers have effectively been asked to do yet again, amounts to “a breach … of duty” and “an abuse of . . . office” — and is therefore sanctionable under professional guidelines.

Even for those who believe in a vision of career civil service that transcends political party, President Trump and Attorney General William P. Barr have put them in an untenable position. The risk of conflict between professional rules and their boss’s demands continues to grow.

I wish normal human ethics were enough to persuade smart lawyers to stop advancing the president’s agenda. But if professional legal ethics make more of them think twice, I will take it. And if Trump administration lawyers choose to ignore those rules, the bar associations charged with punishing professional misconduct should get to work.