FILE - In this June 1, 2017, file photo, Supreme CourtAssociate Justice Anthony M. Kennedy joins other justices of the U.S. Supreme Court for an official group portrait at the Supreme Court Building in Washington. The 81-year-old Kennedy said Tuesday, June 27, 2018, that he is retiring after more than 30 years on the court.(AP Photo/J. Scott Applewhite, File)

FILE - In this June 1, 2017, file photo, Supreme CourtAssociate Justice Anthony M. Kennedy joins other justices of the U.S. Supreme Court for an official group portrait at the Supreme Court Building in Washington. The 81-year-old Kennedy said Tuesday, June 27, 2018, that he is retiring after more than 30 years on the court.(AP Photo/J. Scott Applewhite, File)

WASHINGTON (AP) — Justice Anthony Kennedy, the Supreme Court’s decisive man in the middle on abortion, gay rights and other contentious issues, announced his retirement Wednesday, giving President Donald Trump a golden chance to cement conservative control of the nation’s highest court.

The 81-year-old Kennedy, often a voice of moderation over three decades on the court, provided the key vote on such closely divided issues as affirmative action, guns, campaign finance and voting rights in addition to same-sex marriage and the right to abortion.

ADVERTISEMENT

Kennedy informed his colleagues of his plans, then went to the White House to meet with Trump, where the president said they talked for half an hour about a potential successor and other topics. The retirement will take effect at the end of July.

Trump praised Kennedy as a man of “tremendous vision” and said his search for a new justice would begin “immediately.”

Without Kennedy, the court will be split between four liberal justices who were appointed by Democratic presidents and four conservatives who were named by Republicans. Trump’s nominee, likely to give the conservatives a solid majority, will face a Senate confirmation process in which Republicans hold the slimmest majority but Democrats can’t prevent a vote.

Several former law clerks have said that Kennedy, a nominee of President Ronald Reagan, preferred to be replaced by a Republican. If he had waited, and if Democrats had taken control of the Senate in November, Trump could have found it more difficult to get his choice confirmed.

The other two older justices, Ruth Bader Ginsburg, 85, and Stephen Breyer, 79, are Democratic appointees who would not appear to be going anywhere during a Trump administration if they can help it.

Trump’s first high court nominee, Neil Gorsuch, was confirmed in April 2017. If past practice is any indication, the president will name a nominee within weeks, setting in motion a process that could allow confirmation by the time the court reconvenes in early October.

Trump already has a list of 25 candidates — 24 judges and Utah Sen. Mike Lee — and has said he would choose a nominee from that list.

Abortion is likely to be one of the flash points in the nomination fight. Kennedy has mainly supported abortion rights in his time on the court, and Trump has made clear he would try to choose justices who want to overturn the landmark Roe v. Wade decision. Such a dramatic ruling may not be immediately likely, but a more conservative court might be more willing to sustain abortion restrictions.

“If Donald Trump, who has promised to overturn Roe v. Wade, picks someone who is anti-choice, the future of Roe v. Wade is very much in question,” said David Cole, national legal director for the American Civil Liberties Union.

Interest groups across the political spectrum are expected to mobilize to support and fight the nomination because it is so likely to push the court to the right.

Republicans currently hold a bare 51-49 majority in the Senate, although that includes the ailing Sen. John McCain of Arizona. If Democrats stand united in opposition to Trump’s choice, Senate Majority Leader Mitch McConnell of Kentucky can lose no more than one vote. If the Senate divides 50-50, Vice President Mike Pence could break a tie to confirm the nominee.

Prominent on the list of possible successors are Judges Thomas Hardiman of Pennsylvania and William Pryor of Alabama, who were seriously considered for the seat eventually filled by Gorsuch, and Judge Brett Kavanaugh, who serves on the federal appeals court in Washington. Judges Amy Coney Barrett, whom Trump named to the federal appeals court in Chicago, and Raymond Kethledge, a former Kennedy law clerk who serves on the appeals court based in Cincinnati, also may be considered.

Kavanaugh is a longtime Washington insider, also a onetime Kennedy clerk and a key member of independent counsel Kenneth Starr’s team that produced the report that served as the basis for President Bill Clinton’s impeachment. In October, Kavanaugh dissented when his court ruled that a teenage migrant in federal custody should be able to obtain an abortion immediately.

Regardless of who replaces him, Kennedy’s departure will be a major change for the high court, where he has been the crucial swing vote for more than a decade. He has sided with the liberal justices on gay rights and abortion rights, as well as some cases involving race, the death penalty and the rights of people detained without charges at the Guantanamo Bay naval base. He has written all the court’s major gay-rights decisions, including the 2015 ruling that declared same-sex marriage is a constitutional right nationwide.

However, he also has been a key vote when conservatives have won major rulings on the outcome of the 2000 presidential election in favor of George W. Bush, on gun rights, limiting regulation of campaign money and gutting a key provision of the landmark federal Voting Rights Act.

There were no outward signs that Kennedy was getting ready to retire. He had hired his allotment of four law clerks for the term that begins in October and he is planning to spend part of the summer as he typically does, teaching a law school class in Salzburg, Austria.

Few obstacles seem to stand in the way of confirming Kennedy’s replacement before the court reconvenes in October. Republicans changed the rules during Gorsuch’s confirmation to wipe out the main delaying tactic for Supreme Court nominees, the filibuster, and the need for 60 votes to defeat it.