Supreme Court Justice Anthony Kennedy speaks in San Diego in July 2015. (Denis Poroy/ASSOCIATED PRESS)

David Cole is a professor at Georgetown Law and author of “Engines of Liberty: The Power of Citizen Activists to Make Constitutional Law.”

For years, the Roberts court has been, for all practical purposes, the Kennedy court. It has almost always been Anthony M. Kennedy, not Chief Justice John G. Roberts Jr., who has provided the decisive vote in closely divided cases — leading the court, year after year, to reach more liberal outcomes than many expected. Whether on marriage equality, mandatory life sentences for juveniles, the detention of enemy combatants at Guantanamo, overcrowded prisons, or Arizona’s anti-immigration laws, Kennedy has parted company with fellow conservatives to recognize the rights of the disadvantaged.

Kennedy’s decisive role — siding sometimes with his conservative colleagues, sometimes with the more liberal bloc — seemed likely to shift when Justice Antonin Scalia died, leaving the court equally split at 4 to 4. On issues that divide along traditional ideological lines, many assumed the court would be hopelessly deadlocked. Ties did happen this term, most notably in the review of President Obama’s immigration initiative, letting stand a lower-court injunction that blocked the program. Yet Kennedy once again managed to cast the decisive vote in the term’s two most controversial — and consequential — decisions: on affirmative action and abortion. And he did it, as he so often has in the past, by being willing not just to break rank, but to reconsider his own prior judgments.

In the term’s biggest surprise, Kennedy swallowed his own longstanding antipathy to race-conscious remedies to uphold an affirmative action plan at the University of Texas. He had never before seen an affirmative action policy he could support. In 1990, he compared a Federal Communications Commission “broadcast diversity” program to South Africa’s apartheid regime. When the court in 2003 upheld an affirmative action plan at the University of Michigan law school, Kennedy issued a passionate dissent, calling the school’s quest for a “critical mass” for diversity purposes “a delusion used by the Law School to mask its attempt to make race an automatic factor in most instances.”

And in an earlier appeal in the University of Texas case, Kennedy wrote the majority opinion overturning a lower-court decision for failing to apply sufficiently rigorous scrutiny.

So most court-watchers expected the Texas program to fall. Even after Scalia’s death, that result seemed likely, because Justice Elena Kagan was recused, giving what looked like a clear majority to the remaining four conservatives, all of whom were strongly on record in opposition to affirmative action.

Yet in Fisher v. University of Texas, Kennedy blinked. Holding the power to end affirmative action, he instead voted to uphold the practice. Siding with Justices Ruth Bader Ginsburg, Stephen G. Breyer and Sonia Sotomayor, he reasoned that Texas’s consideration of race satisfied “strict scrutiny,” because the university had tried and considered race-neutral alternatives, and because race was only a modest “factor of a factor of a factor” in a holistic consideration of the applicant’s file. Diversity, he argued, could not be reduced to a precise number, and the university had to be given deference in its assessment of diversity’s educational benefits. Affirmative action survived.

Then, on the court’s last day of the term, Kennedy again sided with the liberal justices, this time to strike down Texas’s regulations of abortion clinics. At issue in the case were rules requiring doctors at abortion clinics to obtain “admitting privileges” at nearby hospitals, and imposing on abortion clinics the much higher — and more costly — standards mandated for “ambulatory surgical centers.” The rules had resulted in the closure of half the state’s abortion facilities.

Kennedy’s vote in Whole Woman’s Health v. Hellerstedt was critical; a 4-to-4 split along liberal-conservative lines would have left standing the lower-court decision upholding Texas’s restrictions. Instead, in a 5-to-3 opinion written by Breyer but joined by Kennedy, the court held that the restrictions, ostensibly enacted in the name of women’s health, in fact furthered no health interests whatsoever, and instead created significant obstacles for women seeking abortions.

The Whole Woman’s Health decision gives teeth to the “undue burden” standard that the court announced in 1992 in Planned Parenthood v. Casey. In Casey, too, Kennedy broke rank with his conservative colleagues — despite his own prior criticisms of Roe v. Wade — to uphold the core of the abortion right against a Reagan administration-backed effort that seemed likely to overturn it. There, as in Fisher, Kennedy stopped short of reversing established precedent. But in the years since, until Monday’s ruling, Kennedy had not encountered another abortion restriction he considered undue.

Breaking with one’s peers and rethinking one’s commitments are not easy. In our increasingly divided political culture, many of us rarely do. But it is the welcome sign of an open mind, an attribute especially important in those who hold the power to enforce constitutional law.