US Supreme Court Justice Anthony Kennedy is to retire, giving President Donald Trump the chance to cement a conservative majority on the top court. The conservative has sided with liberals on many decisions, including the 5-4 rulings that decided same-sex marriage and upheld abortion rights.
In his letter to Mr Trump, Justice Kennedy expressed "profound gratitude" for having served in the highest court.
The 81-year-old judge will retire on 31 July, he said in his letter.
He is the second-oldest justice on the nine-member US Supreme Court.
The court plays a key role in American life and is often the final word on highly contentious laws, disputes between states and the federal government, and final appeals to stay executions.
In recent years, it has expanded gay marriage to all 50 states, halted President Barack Obama's immigration orders and delayed a US plan to cut carbon emissions while appeals went forward.
Earlier this week it upheld Mr Trump's travel ban which covers people from several Muslim-majority countries, in a 5-4 conservative majority ruling.
Senate Majority Leader Mitch McConnell, a Republican, said on Wednesday that a vote on Mr Trump's nominee to replace Justice Kennedy - who earned a reputation as the court's "swing" vote - would take place by the autumn.
Justice Kennedy has frequently sided with abortion rights advocates in the court and news of his retirement has raised fears among pro-choice groups that access to legal abortions in several states could be under threat.
Justice Kennedy said he was retiring because he wanted to spend more time with his family.
Who is Anthony Kennedy?
Justice Kennedy, who was raised in California, was nominated by President Ronald Reagan and began his term in 1988.
He voted conservative on issues of campaign finance, voting rights and gun rights but was considered a swing vote on key rulings.
Justice Kennedy penned the Supreme Court's first major gay-rights decision in 1996, protecting LGBT Americans from discrimination.
In 2015, he authored the landmark opinion which gave LGBT citizens the right to marry, writing: "They ask for equal dignity in the eyes of the law and the Constitution grants them that right."
As a justice, he routinely favoured personal liberty and the limiting of federal power.
Mr Trump said Justice Kennedy had "displayed great vision" and "tremendous heart".
Timing is everything
Anthony Zurcher, BBC News, Washington
Without Anthony Kennedy, the political centre on the Supreme Court will be firmly on the right. Whoever Donald Trump nominates - and he's promised to draw from the same list of candidates from which he picked Neil Gorsuch - will be a person with solid conservative bona fides.
Democrats and liberal activists will howl, rage and do all they can to slow the process, but the timing of Mr Kennedy's retirement makes what happens next all but inevitable. The president will surely offer his choice quickly, and if Republican senators stick together they have the votes to confirm before November's mid-terms congressional elections, let alone when new senators are sworn in next January.
And even if the court vacancy becomes a campaign issue, the open seat in 2016 proved that court vacancies are a much stronger motivating consideration for Republicans - particularly evangelical voters - than they are for Democrats.
File this as yet another entry in the "elections have consequences" scrapbook.
If Hillary Clinton had prevailed in 2016, Democrats would be contemplating a 6-3 liberal Supreme Court majority and an opportunity to reshape the legal landscape for a generation. Instead, on subjects like abortion law and gay rights, the pendulum is swinging the other direction.
What's the reaction?
During a meeting with Portuguese President Marcelo Rebelo de Sousa at the White House, President Trump said he would select a nominee to replace Justice Kennedy from a list of 25 potential court candidates that his campaign had compiled during the election.
Mr Trump said the process to replace him would begin immediately.
"Hopefully we will pick someone who is just as outstanding", he said.
Mr Trump added that he had learned of the judge's retirement about a half hour before, when Justice Kennedy came to the White House to meet him.
The White House also released a statement thanking Justice Kennedy for his 30 years of service as a "tireless voice for individual rights".
"His words have left an indelible mark not only on this generation, but on the fabric of American history."
Top Democrat Chuck Schumer said in a televised speech on the floor of the Senate that Justice Kennedy's replacement would be a decision affecting "generations".
"Our Republican colleagues in the senate should follow the rule they set in 2016, not to consider a Supreme Court Justice in an election year," Senator Schumer said.
"Anything but that would be the absolute height of hypocrisy."