President Trump’s first 100 days deserve at least one superlative: The Trump administration has managed to alienate the courts to a degree that some administrations take years to achieve.

The latest Trump defeat came Monday in the U.S. District Court for the Northern District of California. That case, County of Santa Clara v. Trump, has now produced a nationwide injunction against another Trump executive order: “Enhancing Public Safety in the Interior of the United States,” issued on January 25. On Tuesday, federal district judge William Orrick of the Northern District of California, blocked section 9(a) of the order. That’s the enforcement mechanism of the order’s ill-defined attack on “sanctuary” cities and counties that refuse to take orders from the Department of Homeland Security.

To a degree unusual in public law litigation, Trump’s legal setbacks flow from his personal flaws: constitutional illiteracy, governmental inexperience, contempt for law and lawyers, lust for executive power, and—most of all—simple inability to keep his mouth shut.

To begin with, the executive order would probably get an F in a first-year legal writing class. Among its sins, it announces measures against “sanctuary jurisdictions” but provides no definition of that term. Its goal is to convince—or more properly intimidate—local governments in two ways. First, a number of cities have concluded that their police agencies will be more effective in solving crime if victims, witnesses, and suspects can talk to them without being afraid that police will turn them in to U.S Immigration and Customs Enforcement. Trump, Attorney General Jeff Sessions, and Secretary of Homeland Security John Kelly want those localities to scrap those policies, and instead to let their law-enforcement officers not only pass information to ICE, but also to work as temporary immigration-enforcement personnel.

Second, they want local jail authorities to honor ICE “detainers.” These are administrative requests (not court orders) to local jails to hold certain aliens—suspected of being undocumented—for 48 hours.  Even if there are no charges pending against them, ICE agents want them held until they can pick them up with an eye to deportation. There are two problems with the detainers. First, they don’t come with funding. (According to figures submitted by Santa Clara County in this case, complying with detainers can cost it nearly $8 million a year.) Second, holding anyone—citizen or not—without probable cause or a court order is unconstitutional; and the feds don’t pay the cost of lawsuits either.

Orrrick’s tone is polite; but boiled clean, he reaches three conclusions. First, even the government doesn’t know what the order means and thus localities can’t comply even if they want to; second, the order is a naked grab for executive power—usurping not only the Tenth Amendment powers of states, but also the Article I spending power of Congress; and third (just as with the claim that the travel-ban order is actually a Muslim ban), Trump’s own intemperate words have sealed the order’s fate.

The judge notes that the two plaintiffs—the City of San Francisco and the nearby Santa Clara County—depend on federal funds, among other things, “to provide medical care, social services, and meals to vulnerable residents, to maintain and upgrade roads and public transportation, and to make needed seismic upgrades.” The executive order gives the Attorney General and the Secretary of Homeland Security the authority to designate any locality as a “sanctuary jurisdiction” and then “take appropriate enforcement action” to block some or perhaps even all of this funding.

This threat of catastrophic revenue loss is designed to force the counties to enforce federal immigration law. This is unconstitutional in no fewer than three ways. First, the Supreme Court has repeatedly said that the federal government can’t directly require states to enforce federal law. Second, the Supreme Court has also said repeatedly that the feds can’t use the threat of funding cutoffs so large that they  “coerce” states into complying with conditions that would be unconstitutional if made as direct orders. And third, the court has said that only Congress can impose conditions on federal grants. The president cannot, with a stroke of his own pen, transfer this core power to himself or his appointees.

To make matters worse, no locality would know how to follow the order if it wanted to, the opinion notes. The order prescribes penalties for jurisdictions that “willfully refuse to comply” with federal immigration law; but the government admitted in court that “the Attorney General and Secretary of Homeland Security have not yet figured … out” what those words mean. In addition, Orrick writes, “at least as of two months ago, the Secretary himself stated that he ‘do[esn’t] have a clue’ how to define ‘sanctuary city.’”

The final nail in the order’s coffin was driven by Donald Trump’s mouth. The government argued that the order merely encourages localities to cooperate voluntarily. However, the judge quoted Trump as saying: “I don’t want to defund anybody. I want to give them the money they need to properly operate as a city or a state. If they’re going to have sanctuary cities, we may have to do that.  Certainly that would be a weapon.” He noted that Sessions escalated the threat, saying that he would not only withhold future funds, but “claw back any funds awarded to a jurisdiction” that did not follow federal orders.

In fact, Trump and Sessions have both “called out” California in particular, Orrick noted. “If we have to we’ll defund, we give tremendous amounts of money to California,” Trump has said. “California in many ways is out of control.” Sessions recently wrote an op-ed in the San Francisco Chronicle specifically charging that the city’s laws are at fault for the death of a murder victim, and urged “San Francisco and other cities to re-evaluate these policies.”

There’s no good news for the administration in this opinion; in fact, Judge Orrick—like Judge James Robart in Seattle, Judge Derrick Watson in Hawaii, Judge Theodore Chuang in Maryland, and the three-judge appeals panel of the Ninth Circuit that upheld the injunction on the original travel ban—seems by his tone to have concluded that not one word coming from the government or its lawyers can be believed.

Once a judge decides that a client is dishonest and his lawyers are incompetent, regaining credibility is at best hard and most likely impossible. Seldom in history has a president worked so hard and so quickly to convince so many judges that neither his word nor his motives are worthy of respect.