On back-to-back days at the end of its term, the Supreme Court sustained Obamacare against (another) Tea Party challenge and extended the constitutional freedom to marry to same-sex couples nationwide. Thanks to the Roberts Court, millions of working-poor and middle-income people won’t lose their health insurance, and millions of gay and lesbian Americans will have the right to marry. But this is the same Court that has sharply restricted affirmative action, invalidated a critical section of the Voting Rights Act, freed corporations to spend unlimited amounts of money on political campaigns, and allowed businesses to compel arbitration in contracts that effectively precludes all remedies for illegal discrimination. So what happened this time?

The simple answer in both instances is Justice Anthony Kennedy, who is the decisive vote so often that we really should call it the Kennedy Court.

Kennedy was the swing vote on same-sex marriage, and in the Obamacare decision, Chief Justice John Roberts joined him in siding with the liberals. The dissenters in both cases excoriated their conservative friends not only for deserting them, but also for abandoning the proper judicial role. In Antonin Scalia’s view, the Court in King v. Burwell (the Obamacare case) impermissibly rewrote the statute—so much so that from now on, the justice opined, the law ought to be called “SCOTUScare.” In Obergefell v. Hodges (the marriage decision), Roberts’s dissent accused Kennedy and the majority of “an act of will, not legal judgment,” while Scalia railed against the “hubris reflected in today’s judicial Putsch.”

In fact, both decisions reflect a Court (or at least a majority) that is highly attuned to its responsibility in a democracy. In the Obamacare case, the challengers had sought to enlist the Court in a game of “gotcha” with Congress, fixing on four words—“established by the State”—found in an obscure subsection of a 900-page statute and urging the Court to adopt an interpretation that would have heralded the law’s demise. They argued that the four words should preclude tax credits for anyone in the 34 states that are serviced by a federally administered insurance exchange. This reading would have rendered meaningless several other provisions in the statute, made the federal exchanges unworkable, and altogether doomed local insurance markets, which require the broad participation of healthy individuals, made possible through tax credits. Respecting Congress’s decision to enact the law, the Court properly allowed it to function as the lawmakers plainly intended.

The marriage decision is different. Here, the question was whether the Court would recognize a new constitutional right and require the states to afford same-sex couples the right to marry. It was little surprise that Kennedy wrote the decision: He has now written every major gay-rights ruling that the Court has made over the last 20 years—striking down first a Colorado referendum barring the protection of gays and lesbians under anti-discrimination codes; then a Texas law making homosexual sodomy a crime; then, last year, the federal Defense of Marriage Act.

Kennedy reasoned that the right to marry is a fundamental one, and that the reasons we protect it apply equally to same-sex couples. For straight and gay alike, he wrote, marriage furthers personal autonomy, intimate association, and child rearing, and is “a keystone of our social order.” As a result, there is no good reason to deny same-sex couples equal access to marriage.

The decision rested primarily on the Constitution’s due-process clause, which the Court has previously interpreted to protect the rights of contraception, sexual intimacy, abortion, and the marriage rights of interracial couples, prisoners, and fathers behind on their child-custody payments. Kennedy also relied on the equal-protection clause, ruling that the state had advanced no compelling reason to treat gay and straight couples differently with regard to marriage.

The dissenters charged the majority with having unilaterally redefined marriage, abandoning the framers’ original intent and imposing their own views of morality on the nation. But these criticisms are overwrought. The definition of marriage was precisely at issue in the case. If original intent still controlled constitutional law, racial segregation and sex discrimination would be valid today. And the Court did not impose its own views of morality, but rather its own best reading of a constitutional tradition that has for decades recognized protection for marriage and associated intimate, private rights.

But most important, the Court did not invent the right to same-sex marriage through an act of pure will. Obergefell was the capstone of a more than two-decades-long struggle by people committed to a vision of equality. When that struggle began, the idea of same-sex marriage was an oxymoron; by the time the Court took up the question, it had become an inevitability. That change came about not through the whim of five justices, but through the painstaking work of thousands of people across the country committed to an idea of equality—and willing to fight for it in state legislatures and courts, on state referendums, in their churches and their communities. And that is just how constitutional law has generally evolved in our society: through the persistent struggle of groups of committed citizens.

Chief Justice Roberts closed his dissent in Obergefell by acknowledging that many would celebrate the decision, but that they should “not celebrate the Constitution. It had nothing to do with it.” He’s wrong. If constitutional law is understood as an evolving doctrine rather than the dead hand of the past, we should celebrate not just the decision, but the Constitution itself—and the people who have worked so long and hard to make constitutional law reflect our deepest commitments to equal dignity for all.