Justice Anthony Kennedy has announced his intention to retire from the Supreme Court, giving President Donald Trump a second opportunity to nominate a solid constitutionalist justice.

Here’s a look at Kennedy’s jurisprudence and what’s at stake in the Senate’s confirmation of his successor, who undoubtedly will face fierce resistance from the left.

When President Ronald Reagan appointed Kennedy to the Supreme Court in 1987, the jurist had spent more than a decade on the U.S. Court of Appeals for the 9th Circuit.

A California native with ties to Reagan from his days as governor, Kennedy was the third choice to replace Justice Lewis Powell Jr. after the failed nominations of the Robert Bork and Douglas Ginsburg.

Known for his affinity for foreign cultures, Kennedy, 81, spends many of his summers teaching in Austria, travels annually to China with the American Bar Association, and has advised nascent democracies on their constitutions.

‘King Kennedy’

On occasion—for good or ill—this affinity for foreign mores has crept into his work at the Supreme Court. Chief Justice John Roberts and others have described the practice of citing foreign law as “looking out over a crowd and picking out your friends” (meaning it’s a way to find support for just about any legal argument).

For example, Kennedy approvingly cited European courts in his majority opinion in Lawrence v. Texas, striking down the state’s ban on sodomy, as well as in Boumediene v. Bush, extending the writ of habeas corpus to detainees held at Guantanamo Bay. Likewise, he pointed to the “climate of international opinion” as not dispositive but instructive in limiting the availability of life-without-parole sentences for juvenile offenders in Graham v. Florida.

Hailed as “King Kennedy” and “the Decider,” Kennedy’s ideology placed him squarely in the middle of the two wings of the Supreme Court. He often sided with the conservative justices in religious liberty, civil rights, voting rights, and campaign finance cases upholding the First Amendment (e.g., Burwell v. Hobby Lobby, Town of Greece v. Galloway, Shelby County v. Holder, Citizens United v. FEC, McCutcheon v. FEC, Schuette v. BAMN, D.C. v. Heller, and the first Fisher v. University of Texas).

Just this term, he joined the conservative block in 19 cases decided 5-4, including Husted v. A. Philip Randolph Institute, National Institute of Life and Family Advocates v. Becerra, Janus v. American Federation of State, County, and Municipal Employees, and Trump v. Hawaii.

But Kennedy frequently cast the deciding vote in cases advancing socially liberal causes that “discovered” new rights in the Constitution, such as gay rights, abortion, restricting capital punishment, and eliminating life sentences for teenage killers (United States v. Windsor, Obergefell v. Hodges, Lawrence v. Texas, Romer v. Evans, Whole Woman’s Health v. Hellerstedt, Kennedy v. Louisiana, and Miller v. Alabama).

For many of the highest-profile cases in the past 20 years, it came down to Kennedy. He was in the majority of nearly 90 percent of cases decided by a vote of 5-4 in the past five years, and 75 percent for the past 20 years.

Though he once said “the cases swing, I don’t,” litigators have spent the past two decades angling for Kennedy’s vote. Indeed, Jeffrey Rosen, a law professor and head of the National Constitution Center, dubbed as the “Kennedy brief” any brief that sought to curry favor by “repeatedly citing the opinions of Justice Kennedy.”

Kennedy Clashes With Kennedy

It’s not always been easy for Supreme Court watchers to pigeonhole Kennedy’s jurisprudence. In fact, one mainstay of his jurisprudence and view of the Constitution was its inconsistency.

He authored the majority opinion in Gonzales v. Carhart and co-authored the plurality in Planned Parenthood of Southeastern Pennsylvania v. Casey, where abortion regulations were upheld under the most deferential standard of review (rational basis).

But then he joined the liberals in Whole Women’s Health v. Hellerstedt, requiring Texas to meet a higher standard of review for its commonsense regulation of abortion providers.

In Schuette v. BAMN, a case about a state’s ability to prohibit racial preferences in college admissions, Kennedy wrote:“It is demeaning to the democratic process to presume that voters are not capable of deciding an issue of this sensitivity on decent and rational grounds. … Freedom embraces the right, indeed the duty, to engage in a rational, civic discourse in order to determine how best to form a consensus to shape the destiny of the Nation and its people.”

Yet the following year, in Obergefell v. Hodges, Kennedy was unwilling to extend the same goodwill to voters to decide through the democratic process whether their states should recognize same-sex marriages, cutting short a vibrant public debate over the issue.

Writing for the majority in Fisher v. University of Texas at Austin in 2013, Kennedy held that the university must prove that its use of race in admissions met the requirements of the 14th Amendment’s Equal Protection Clause and sent the case back to the lower court. When the case returned in 2016, Kennedy wrote for the majority again, gutting his 2013 decision and allowing the university to continue sorting students by race without defining its diversity goals or proving that race was necessary to meet its goals.

‘Sweet Mystery of Life’

Kennedy viewed the 14th Amendment’s Due Process Clause protection of “liberty” rather expansively. At times, this drew the ire of the late Justice Antonin Scalia. In two scathing dissents, Scalia took issue with Kennedy’s discussion of “liberty.”

Of Kennedy’s majority opinion in Obergefell v. Hodges (the same-sex marriage case), Scalia wrote: “If, even as the price to be paid for a fifth vote, I ever joined an opinion for the Court that began: ‘The Constitution promises liberty to all within its reach, a liberty that includes certain specific rights that allow persons, within a lawful realm, to define and express their identity,’ I would hide my head in a bag. The Supreme Court of the United States has descended from the disciplined legal reasoning of John Marshall and Joseph Story to the mystical aphorisms of the fortune cookie.”

Dissenting from Kennedy’s majority opinion in Lawrence v. Texas (the anti-sodomy case), Scalia mockingly referred to the “sweet-mystery-of-life passage [from Planned Parenthood of Southeastern Pennsylvania v. Casey] … ‘At the heart of liberty is the right to define one’s own concept of existence, of meaning, of the universe, and of the mystery of human life.’ … I have never heard of a law that attempted to restrict one’s ‘right to define’ certain concepts; and if the passage calls into question the government’s power to regulate actions based on one’s self-defined ‘concept of existence, etc.,’ it is the passage that ate the rule of law.”

But this same concern for dignity led Kennedy to rule for baker Jack Phillips in Masterpiece Cakeshop v. Colorado Civil Rights Commission this term, writing that the state commission demonstrated “clear and impermissible hostility toward [Phillips’] sincere religious beliefs.”

Kennedy has had a complicated relationship with conservatives and originalists who believe in applying the Constitution according to its original public meaning.

The times when he joined conservatives to uphold the rule of law and properly interpret the Constitution couldn’t necessarily make up for all the cases where he went in the opposite direction and moved the judiciary beyond its limited constitutional role.

Liberals will cheer Anthony Kennedy for being a champion of gay rights, but now conservatives will thank him for giving Trump the opportunity to appoint another committed originalist to the Supreme Court.  And let’s all wish him well in his retirement.