Linda Hirshman’s forthcoming book is “Reckoning: The Epic Battle Against Sexual Harassment and Abuse.”

By a bare majority of five, on the last day of its term, the Supreme Court issued a decision on a matter fundamental to the national political divide. No, not abortion; something bigger. In a nation of laws, the Supreme Court held, you cannot have your own facts.

Specifically, the court held Monday that no matter what the state of Texas said, its sweeping restrictions on abortion were hurting women, not helping them. And that’s a fact. The decision in Whole Women’s Health v. Hellerstadt, which refused to honor Texas’s assertions of the beneficence of its clinic-closing legislation, came exactly one year after Obergefell v. Hodges, where the court refused to defer to state legislatures’ findings that banning same-sex marriage was better for children and that social change was dangerous. In a time of fact-free politics, the judicial branch is holding firm.

Factual disputes like these matter to the legal system because states can’t just decide to harm groups of their citizens, particularly when highly protected rights like abortion and marriage are involved. If states can’t prove that restrictions on their citizens’ freedom are justified by some allowable reason, the laws fail. It takes facts to show that laws confer important benefits or that they don’t harm protected interests (or both), so when the Supreme Court rejected the legislatures’ facts, the cases were basically settled right there.

Way below the exalted legal formulations and references to past decisions that fill up oral arguments and written briefs before the court, proof of those allowable reasons involves stuff like testimony and statistics. How many abortion clinics will close? How do children fare in adoptive families? DeBoer v. Snyder, one of the six marriage cases consolidated under the Obergefell litigation, went to trial on the factual dispute over the rationale for the Michigan state prohibition of same-sex marriage. Similarly, in the abortion dispute, the district court in Texas held a four-day trial over how women would be helped or hurt by the state’s very demanding abortion regulations. As usual, the lower courts applied the age-old rules of evidence. Experts had to be qualified, and evidence had to be relevant to the point being made with it.

In both cases, the challengers of the laws made a robust record and convinced trial judges that the states’ restrictions were not helping either women or children. The states’ task of proving their cases was made harder in both instances because their supposed justifications were pretextual. The real purpose of the Texas abortion laws was not to ensure women’s safety, but rather to make women’s access to abortion as hard as possible. Periodically, during the battle over the Texas law, some antiabortion sponsor blurted out the real purpose. Since the cases  establishing the right to abortion forbid that justification, they had to cloak their agenda.

Similarly, the laws against same-sex marriage were heavily driven by religious prohibitions and pure distaste: The overwhelming majority of the money supporting the bans came from religious donors; voters were mobilized through church networks; and prominent Michigan campaigner Gary Glenn has said repeatedly that homosexuality should be criminalized. Since both the First Amendment and prior precedent on gay rights prohibited those justifications, the opponents of marriage equality had to disguise their motives, as well.

In both matters, the trial courts ruled against the states. When it comes to who ultimately prevails at the Supreme Court, losing at the lowest federal district court is a big deal. Federal appeals courts and the Supreme Court get most of their factual information from the record established in lower courts. Those factual records followed the cases all the way to the Supreme Court.

With both the marriage and abortion cases, the intermediate appeals courts reversed the trial courts and ruled for the states. In strikingly similar terms, the circuit courts in each case held that the trial courts should not have made their own findings of fact. Rather, the courts held, trial judges should have deferred to the findings the state legislatures set forth as justification for passing the laws in the first place. The states, in effect, could have their own facts.

Those appeals court opinions posed a threat to the rule of law well beyond the specific subject matter of the cases they decided. Abortion rights matter. Marriage equality matters. But neither matters as much as the fundamental integrity of lawmaking. Making law on the basis of falsehoods, or assertions that cannot either be proven or reached by reason, threatens society at a basic level.

In each case, the justice writing the majority opinion found a way not only to strike down the circuit court rulings, but to underline the importance of facts as the bedrock of laws. Last year in the marriage case opinion, Justice Anthony Kennedy flatly rebutted Ohio’s argument that same-sex marriage would devalue heterosexual marriage and therefore harm children, dismissing it as “unrealistic.”

But in the abortion ruling this week, Justice Stephen Breyer was faced with a recent Supreme Court precedent on the abortion question that seemed to point toward judicial deference to the legislature, so he had to take the issue on directly. His opinion is a paean to the role of the legal process. “For a district court to give significant weight to evidence in the judicial record,” Breyer wrote, “is consistent with this Court’s case law. As we shall describe, the District Court did so here. It did not simply substitute its own judgment for that of the legislature. It considered the evidence in the record — including expert evidence, presented in stipulations, depositions, and testimony.” Then, in the most damning way, Breyer simply listed seven bullet points of the kind of evidence the trial court had used, just to reject the state’s argument that abortion doctors had to have admitting privileges at hospitals to care for women’s health.

And then he put in the shiv: “We add that, when directly asked at oral argument whether Texas knew of a single instance in which the new requirement would have helped even one woman obtain better treatment, Texas admitted that there was no evidence in the record of such a case.”

Fusty old rules like who can be an expert and what counts as persuasive sound funny in legal procedurals on TV. “Objection your honor! Incompetent, irrelevant and immaterial!” interrupts the flow of storytelling in courtroom dramas. But the principles those objections represent are the best protection freedom has. In his commentary on America two centuries ago, Alexis de Tocqueville noted that every great question sooner or later becomes a matter for the courts here. Often, the courts get it wrong, and when courts apply the wrong doctrine or standards, they are no different from any other branch of government. But while the legal system may have lots of room to make bad judgments, and even to make mistakes about evidence, it has little tolerance for simply making up the evidence.