Justice Anthony Kennedy, the court's swing vote , is retiring from the Supreme Court, ending a career on the court that spanned just over 30 years and creating a second vacancy on the Supreme Court for President Trump.

The retirement will be effective July 31, according to a letter Kennedy sent to Trump.

"For a member of the legal profession it is the highest of honors to serve on this court," Kennedy wrote in his letter.

Kennedy celebrated his 30th anniversary on the Supreme Court in February, and as he nears 82, his retirement has frequently been the subject of speculation.

Kennedy’s retirement ensures the court will shift to the right, as Trump has vowed to pick nominees who are in the mold of the late Justice Antonin Scalia. Conservatives said Trump’s first pick, Justice Neil Gorsuch, fulfilled that promise.

Trump told reporters following Kennedy's announcement his pick to fill the seat will likely come from his list of 25 prospective candidates. Twenty-four of those on the list are federal and state judges and the 25th is Sen. Mike Lee, R-Utah. The president first released his list of possible nominees to the high court during the 2016 election, and in November, it grew to 25.

The president praised Kennedy, saying he has displayed "tremendous vision" and a "tremendous heart." The search for Kennedy's replacement will begin "immediately," he said.

"I just want to thank Justice Kennedy for the years of tremendous service," Trump said. "He's a very spectacular man, really a spectacular man, and I know that he will be around hopefully for a long time to advise."

Kennedy visited the White House for roughly 30 minutes Tuesday, Trump said, and the two had a "deep discussion," including on possible successors.

Kennedy's retirement is also likely to stoke fears from Democrats that the Supreme Court could overturn Roe v. Wade, the landmark 1973 ruling that granted women the right to an abortion, once another Trump nominee is in place.

Planned Parenthood executive vice president Dawn Laguens warned "the right to access abortion in this country is on the line."

Kennedy is a native of Sacramento, Calif., who served on the 9th U.S. Circuit Court of Appeals and was nominated by President Ronald Reagan to the Supreme Court in 1987 at the age of 51. He took his seat on the Supreme Court in February 1988.

Across his three decades on the bench, Kennedy has become the court’s swing vote, a position that was solidified after Justice Sandra Day O’Connor retired in 2006.

Kennedy, a devout Catholic, has sided with the liberal wing of the bench in cases on affirmative action and abortion and became a crusader of LGBT rights. In 2015, he authored the majority opinion in the landmark case Obergefell v. Hodges, which legalized same-sex marriage.

“The nature of marriage is that, through its enduring bond, two persons can together find other freedoms, such as expression, intimacy, and spirituality,” Kennedy wrote in the opinion. “This is true for all persons, whatever their sexual orientation.”

Kennedy was also part of the troika, along with O'Connor and Justice David Souter, that authored the majority opinion in the 1992 case Planned Parenthood of Southeastern Pennsylvania v. Casey, which reaffirmed Roe and established that a state's abortion restrictions cannot place an “undue burden” on a woman seeking an abortion.

“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,” Kennedy wrote in the majority opinion in the abortion case.

But the justice sided with conservatives in cases involving campaign finance and the Second Amendment.

Kennedy provided the fifth vote in the 2008 case District of Columbia v. Heller, which struck down the District of Columbia’s handgun ban. The Supreme Court held that the Second Amendment protects an individual right to own a handgun for purposes such as self-defense in the home.

He also wrote the majority opinion in Citizens United v. FEC, the 2010 case that lifted restrictions on corporate spending on elections.

“When government seeks to use its full power, including the criminal law, to command where a person may get his or her information or what distrusted source he or she may not hear, it uses censorship to control thought,” Kennedy wrote in that decision. “This is unlawful. The First Amendment confirms the freedom to think for ourselves.”

The justice's last majority opinion of his tenure on the Supreme Court came last week in the case South Dakota v. Wayfair, in which the high court said that states can require out-of-state online retailers to collect sales taxes. The court’s decision reversed a 1992 Supreme Court decision that limited collections of sales taxes to stores with a physical presence in the state.

In the wake of Kennedy's announcement, Republicans, who currently control the House and Senate, heralded the justice's time on the bench.

Speaking on the Senate floor following the announcement Kennedy would retire, Senate Majority Leader Mitch McConnell praised the justice for his commitment to the First Amendment.

"In particular, we owe him a debt of thanks for his ardent defense of the First Amendment and the First Amendment's right to political speech," he said.

"As Justice Kennedy concludes his tenure on the court, we wish him, his wife Mary, and his entire family every happiness in the years ahead," McConnell said.

Senate Judiciary Committee Chairman Chuck Grassley, R-Iowa, said Kennedy's presence at the Supreme Court will be missed.

“He helped chart the course of American jurisprudence, and made his mark as a staunch defender of First Amendment rights, especially the freedom of speech and religious liberty. He set an example of integrity and wisdom that I hope all jurists will emulate," Grassley said.

Since joining the court in 1988, Kennedy has joined a faction of justices who have drawn upon and cited foreign sources and international law in his opinions, though such references are not new.

In a 2005 article for the New Yorker , legal analyst Jeffrey Toobin said Kennedy's embrace of using foreign law to help interpret the Constitution was the "single biggest factor" that contributed to his shift from a conservative justice to the court's swing vote.

Kennedy cited foreign sources in the majority opinion for the case Lawrence v. Texas, a landmark ruling that invalidated state sodomy laws, and again in the case Roper v. Simmons, which deemed the juvenile death penalty unconstitutional.

But the justice’s citing of foreign and international law was the subject of backlash in 2005, when 84 House Republicans backed a resolution saying the Supreme Court shouldn’t use foreign sources to “inform an understanding of the original meaning of the Constitution.”

Though there have been whispers of a looming Kennedy retirement for the last two years, rumors heightened this year after several Republicans in Congress indicated he would step down.

Sen. Dean Heller, R-Nev., predicted in March that Kennedy would retire in early summer, and Grassley hinted in April the committee may be conducting confirmation hearings for a Supreme Court nominee.

McConnell said the Senate will vote to confirm a new justice this fall, setting up a fiery political fight just before the November midterm elections. But already, Senate Democrats are urging McConnell to wait until after the election before considering any nominee.

"Our Republican colleauges in the Senate should follow the rule they set in 2016: Not to consider a Supreme Court justice in an election year," Senate Minority Leader Chuck Schumer, D-N.Y., said on the Senate floor.

Carrie Severino, chief counsel and political director for Judicial Crisis Network, said she believes any Supreme Court nominee from Trump is likely to be the subject of immense criticism from Democrats.

"I have no doubt that whoever the nominee is, he or she is going to face a raft of unfair and mean-spirited attacks," she told the Washington Examiner. "That's basically part of the Democrats' playbook at this point, and it seems to only ratchet up."

Still, Severino said the vacancy gives the president the chance to "fulfill his most important campaign promise."

Court watchers speculated that Justice Stephen Breyer made a veiled plea in March for Kennedy to remain on the bench for another term. During oral arguments in a partisan gerrymandering case, Breyer suggested the Supreme Court hold another round of arguments in that case as well as two others for the term that begins in October 2018.

Kennedy served on the court in 2004, the last time the justices heard a partisan gerrymandering case, and said the court could wade into such debates if it found a workable standard for measuring when too much partisanship has been injected into the redistricting process.

The Supreme Court ended up skirting the issue of when and whether a partisan gerrymander violates the constitutional rights of voters and sent both partisan gerrymandering cases before it this term back to the lower courts.

Kennedy seemed to quiet doubts about his future on the bench when he hired law clerks for the term beginning in October 2018, though he reportedly warned at least one clerk he could step down.

Ultimately, though, Breyer’s suggestion didn’t seem to sway Kennedy.

