WASHINGTON — If hard cases make bad law, a corollary may be that bad presidents risk making bad law. A president who ignores settled norms and makes maximalist legal arguments in defending his conduct may provoke courts to overreact — solving the problem at hand but setting bad precedents that could bind future occupants of the office.

In its pair of rulings concerning subpoenas for President Trump’s financial records, the Supreme Court appeared heedful of this danger and avoided it. In short, the justices did not let this terrible president make bad law. They neither accepted Trump’s extreme positions nor set out rules that could prove problematic for successors. As a matter of law, this president lost, as he should have; the presidency survived.

The first case, involving a grand jury subpoena to Trump’s accountants from Manhattan District Attorney Cyrus R. Vance Jr., was the easiest, both because precedents so clearly argued for upholding the subpoena and because Trump’s position was absurdly overwrought.

Trump’s personal lawyers contended that a sitting president enjoys absolute immunity from state criminal subpoenas. This is a view of the chief executive as hothouse flower, unable to survive the supposedly distracting, stigmatizing and harassing impact.

This position, as Chief Justice John G. Roberts Jr. noted, was so out there that the solicitor general, representing the interests of the presidency rather than Trump himself, did not endorse it, and the court rejected that argument unanimously.

“No citizen, not even the president, is categorically above the common duty to produce evidence when called upon in a criminal proceeding,” Roberts wrote.

The fallback position, taken by the solicitor general, was that a state prosecutor should have to demonstrate a heightened need when subpoenaing a president. Such subpoenas should be issued only as a “last resort,” when the information is “not available from any other source” and is needed “now, rather than at the end of the president’s term.”

The court majority wasn’t buying it. “That double standard has no basis in law,” Roberts observed.

As a practical matter, the criminal subpoena case, Trump v. Vance, may be the less important. State prosecutors aren’t likely to be issuing a flurry of subpoenas against future presidents, notwithstanding the overheated warnings from Justice Samuel A. Alito Jr., in dissent, that the ruling “provides no real protection against the use of the subpoena power by the Nation’s 2,300-plus local prosecutors.” As Roberts noted, this was the first known state criminal subpoena directed at a president.

Congressional subpoenas are another matter: They are more common, so the court’s road map has real-world consequences.

The court could barely contain its exasperation with being summoned to referee this dispute. As Roberts observed, sounding like a parent annoyed at having to break up a fight among squabbling toddlers — Don’t make me stop this car! — inter-branch struggles have been erupting since the dawn of the republic.

Still – thank you, Trump administration – this was the first time the court had been forced to adjudicate. Historically, disputes over congressional demands for presidential documents have been hashed out, as Roberts wrote, quoting the late justice Antonin Scalia, in the “hurly-burly, the give-and-take of the political process between the legislative and the executive.”

Now that hurly-burly has a set of court-established rules — which strengthen Congress’s hand in future showdowns without unduly weakening the president.

Congress is empowered, in part, because the majority forcefully rejected Trump’s contention, echoed by the solicitor general, that a congressional subpoena for nonprivileged, private information from a president had to be justified by a “demonstrated, specific need.”

That was the standard the court applied in dealing with a subpoena for President Richard M. Nixon’s Oval Office conversations with top advisers, a case that posed legitimate worries about chilling future presidents’ ability to get candid advice. But the Roberts Court slapped down Trump’s efforts to apply this stringent test to his private records, saying that would give “short shrift to Congress’s important interests in conducting inquiries to obtain the information it needs to legislate effectively.”

However, the court said, the House committees seeking Trump’s records had overstepped in going after the material without providing adequate justification, posing the risk that they were engaged in a fishing expedition.

The court set out a four-part test to govern such cases: Could Congress obtain the information it needs for its “asserted legislative purpose” from other sources? Is the requested information too broad? Has Congress provided a “detailed and substantial” explanation of why it needs the material? And is the subpoena too burdensome on the president’s time? This won’t provide an automatic answer in every instance, but it sets reasonable rules going forward.

Meanwhile, the notion that Trump won these cases because his tax returns will remain shielded until after the election misses the bigger point. A dangerously bloated view of presidential power was resoundingly rejected by a conservative court — a court that rebuffed Trump but protected presidents to come.