WASHINGTON (Reuters) - Anthony Kennedy left an indelible mark on American society in his three decades as a mild-mannered and professorial justice on the U.S. Supreme Court in areas as varied as gay rights, abortion, the death penalty and political spending.

FILE PHOTO: U.S. Supreme Court Associate Justice Anthony Kennedy arrives for the funeral of fellow justice Antonin Scalia at the Basilica of the National Shrine of the Immaculate Conception in Washington, February 20, 2016. REUTERS/Carlos Barria/File Photo

Kennedy, who announced his retirement on Wednesday at age 81, became the swing vote on the ideologically divided court after fellow traditional conservative Justice Sandra Day O’Connor retired in 2006. He was the most centrist of the five conservatives currently on the court and was willing to join the liberal justices in major cases, although he delivered strongly conservative opinions in others.

“His jurisprudence prominently features an abiding commitment to liberty and the personal dignity of every person. Justice Kennedy taught collegiality and civil discourse by example,” conservative Chief Justice John Roberts said in a statement.

“His work has made an impressive contribution to the development of the law in many fields, and he will surely be remembered as one of the most important justices in the history of the court,” added conservative Justice Samuel Alito.

Nominated by Republican President Ronald Reagan, Kennedy joined the court in 1988 and followed a deliberative, middle-of-the-road approach. During arguments, Kennedy leaned forward in his black leather chair, looking earnest and wearing wire-rimmed glasses, often asking probing questions of the lawyers.

He authored the 2015 ruling that legalized same-sex marriage nationwide, in one of several cases in which he voted to expand gay rights. Kennedy wrote that the hope of gay people intending to marry “is not to be condemned to live in loneliness, excluded from one of civilization’s oldest institutions. They ask for equal dignity in the eyes of the law. The Constitution grants them that right.”

Although championing gay rights, Kennedy authored a ruling this month that handed a victory on narrow legal grounds to a Colorado baker who, citing his Christian beliefs, refused to make a wedding cake for a same-sex couple.

Kennedy joined the liberals in upholding abortion rights, including a 2016 ruling that struck down a Texas abortion law imposing strict regulations on doctors and facilities. The decision was the strongest endorsement of abortion rights in the United States in more than two decades.

In latter years, Kennedy appeared to evolve on race issues, inching toward his liberal colleagues over policies intended to tackle historic racial discrimination. In 2016, he wrote a ruling that upheld the consideration of race in college admissions in policies designed to boost the enrollment of minority students.

Kennedy also backed limitations on the application of the death penalty, agreeing with liberal colleagues that juveniles and the mentally ill should not be eligible for execution.

‘MODERATING FORCE’

“Justice Kennedy was a critical moderating force on the Supreme Court for decades,” American Civil Liberties Union legal director David Cole said.

“He cast deciding votes to protect freedom of speech, to prevent the overturning of abortion rights, to limit state anti-immigration laws, to stop the execution of children, and to preserve affirmative action. His greatest legacy may rest with his decisions recognizing the dignity and rights of lesbians, gay, and bisexual people. His attention to human dignity and individual rights will be missed,” Cole added.

Kennedy also has heartened conservatives. He authored a 2010 ruling that lifted restrictions on corporate and union-funded independent expenditures during political campaigns. The ruling, based on free-speech rights, prompted considerable criticism, including from then-President Barack Obama.

He joined his fellow conservatives in the 2000 ruling that effectively gave the U.S. presidency to Republican George W. Bush, rather than Democrat Al Gore, by preventing any more vote recounts in Florida.

This week, Kennedy joined the other conservative justices in rulings that upheld the legality of Republican President Donald Trump’s travel ban targeting several Muslim-majority nations, shut down a key source of revenue for labor unions and blocked a California law regulating Christian-based clinics that counsel women against abortion.

Michael Farris, general counsel of the Christian conservative legal group, Alliance Defending Freedom, took issue with “decisions where Justice Kennedy created ‘rights’ not found in or intended by the United States Constitution. He deeply disappointed many Americans with his constitutional jurisprudence favoring abortion and same-sex marriage.”

But Farris praised Kennedy’s protection of freedom of speech including in Tuesday’s decision striking down California’s law that required the anti-abortion centers to notify clients of the availability of state-subsidized abortions.

Kennedy, previously a federal appeals court judge in California, was actually Reagan’s third choice for the job.

After the Senate defeated Reagan’s first choice, conservative firebrand Robert Bork, and his second choice, Douglas Ginsburg, withdrew his nomination after the disclosure he had previously smoked marijuana, Kennedy was nominated. He was confirmed by a 97-0 Senate vote.

Kennedy relished the role of teacher and intellectual. He has an avid interest in English literature, particularly Shakespeare, and in court history.