Justice Anthony Kennedy, a crucial swing vote on the Supreme Court, announced Wednesday he's retiring at the end of July, giving President Donald Trump another chance to fundamentally reshape the highest court in the land. His departure could have massive effects on U.S. policy, particularly on abortion rights and gay rights nationwide. His announcement immediately raised questions about how long the court would stand by its earlier abortion rulings, including Roe v. Wade. In a statement, the Supreme Court said the 81-year-old Kennedy will step down effective July 31. The judge called it "the greatest honor and privilege to serve our nation in the federal judiciary for 43 years, 30 of those years in the Supreme Court." Kennedy wants to spend more time with his family, even though they were content with him staying on the court. He also sent a letter to Trump on Wednesday notifying the president of his decision. The court adjourned for the summer earlier in the day. "For a member of the legal profession, it is the highest of honors to serve on this Court," he wrote. "Please permit me by this letter to express my profound gratitude for having had the privilege to seek in each case how best to know, interpret and defend the Constitution and the laws that must always conform to its mandates and promises."

U.S. Supreme Court Associate Justice Anthony Kennedy. Getty Images

Speaking to reporters Wednesday, Trump called Kennedy a "great justice" who has displayed "tremendous vision and heart." He said a search for his successor will start "immediately." The president's first nominee to the court, conservative Justice Neil Gorsuch, has already had an enormous effect on U.S. policy in narrowly decided rulings this week related to Trump's ban on travel from certain countries, abortion and labor unions. The president said his next choice would come from a previously released list of 25 candidates. Possible candidates when Trump chose a replacement for the late archconservative Antonin Scalia included Appeals Judges Thomas Hardiman and William Pryor, among others. Replacing Kennedy with a conservative could have a massive long-term effect on the highest U.S. court. His decision to leave will have huge implications for the midterm elections, as Democrats and Republicans battle for control of the Senate. The chamber confirms Supreme Court justices. A Supreme Court vacancy could serve to motivate voters, as a young justice would have a chance to serve for decades. Democratic control of the Senate may force Trump to make a more moderate choice for the seat. Kennedy was the second-oldest member of the court. The oldest, Democrat Ruth Bader Ginsburg, is 85 and has been treated for pancreatic cancer. The next oldest after Kennedy is another liberal, Stephen Breyer, who is 79. Senate Republicans will try to fill Kennedy's seat before November. Majority Leader Mitch McConnell said Wednesday "we will vote to confirm Justice Kennedy's successor this fall." McConnell blocked then-President Barack Obama's nominee to fill Scalia's seat, Judge Merrick Garland, clearing the way for Trump to nominate Gorsuch. Kennedy's retirement foreshadowed tension ahead between Senate Republicans and Democrats. Senate Minority Leader Chuck Schumer said Wednesday that Republicans "should follow the rule they set in 2016, not to consider a Supreme Court Justice in an election year." McConnell has made a distinction between presidential and midterm election years.

Kennedy's career

Nominated by President Ronald Reagan and sworn in in 1988, Kennedy became a swing vote on the nine-member court. He often sided with his liberal colleagues, including in the landmark ruling that recognized same-sex marriage in 2015. "No union is more profound than marriage, for it embodies the highest ideals of love, fidelity, devotion, sacrifice and family," he wrote in the majority opinion. "As some of the petitioners in these cases demonstrate, marriage embodies a love that may endure even past death. It would misunderstand these men and women to say they disrespect the idea of marriage. Their plea is that they do respect it, respect it so deeply that they seek to find its fulfillment for themselves. Their hope 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." He also sided with the liberals and Chief Justice John Roberts in the 2015 landmark ruling on the Affordable Care Act. The 6-3 ruling allowed the federal government to provide nationwide tax subsidies to help Americans buy health insurance in the Obamacare program. However, in the 2012 ruling that upheld Obamacare's individual mandate requiring Americans to obtain health insurance, Kennedy sided with the conservative dissent. He said the court's majority "regards its statutory interpretation as modest. It is not. It amounts to a vast judicial overreaching. It creates a debilitated, inoperable version of healthcare regulation that Congress did not enact and the public does not expect." In 1992, Kennedy joined four other justices in a ruling upholding Roe v. Wade. The Stanford and Harvard Law School-educated Kennedy served on the Ninth Circuit Court of Appeals in the western U.S. before his appointment to the highest U.S. court. His tenure on the Supreme Court lasted more than three decades. Kennedy will turn 82 only days before his planned date of retirement. The justice left a parting message of sorts in a concurring opinion he wrote this week when the court upheld Trump's travel ban in a 5-4 ruling. He was the only justice signed on to the opinion.

The First Amendment prohibits the establishment of religion and promises the free exercise of religion. From these safeguards, and from the guarantee of freedom of speech, it follows there is freedom of belief and expression. It is an urgent necessity that officials adhere to these constitutional guarantees and mandates in all their actions, even in the sphere of foreign affairs. An anxious world must know that our Government remains committed always to the liberties the Constitution seeks to preserve and protect, so that freedom extends outward, and lasts. Justice Anthony Kennedy

Correction: An earlier version misstated the year that the Supreme Court ruled in favor of nationwide tax subsidies to help Americans buy health insurance in the Obamacare program. It was 2015.

WATCH: Trump considering list of 25 names for Supreme Court