A conservative replacement for liberal icon Justice Ruth Bader Ginsburg, who died Friday night at age 87, could shift the Supreme Court’s majority markedly to the right for generations, and transform its jurisprudence on issues such as gun rights, affirmative action and the right to abortion established in Roe v. Wade.

More immediately, Ginsburg’s death for now leaves the court with only eight members to confront potentially history-shaping issues resulting from one of the nation’s most contentious presidential elections.

The court has already refereed a number of battles between Republicans and Democrats regarding voting rights. A majority of six conservative justices could potentially decide a host of other issues raised by the election itself. The court’s ruling in Bush v. Gore in 2000 essentially decided the presidential election for George W. Bush.

With Ginsburg’s death, the court now has five conservative justices nominated by Republican presidents and three liberals nominated by Democrats. Chief Justice John G. Roberts Jr. emerged as the pivotal member of the court in its most recent term, sometimes siding with his fellow conservatives to form a majority and sometimes with the court’s liberals.

But his power depends on his being at the center of the court, with four justices more conservative and four more liberal.

Both of President Trump’s nominees — Justices Neil M. Gorsuch and Brett M. Kavanaugh — are more conservative than Roberts is. And a third would dilute Roberts’s power as the court’s median justice.

There was, of course, no mention of that Friday night in the chief justice’s tribute to Ginsburg.

“Our Nation has lost a jurist of historic stature,” he said in the court’s statement announcing her death. “We at the Supreme Court have lost a cherished colleague. Today we mourn, but with confidence that future generations will remember Ruth Bader Ginsburg as we knew her — a tireless and resolute champion of justice.”

Ginsburg had resisted overtures to retire when Barack Obama was still president so that he could name her successor, and she had hoped to continue to serve until age 90. She had also clearly expected Hillary Clinton to be elected president in 2016.

“I think it’s going to be another Democratic president,” Ginsburg told The Washington Post in 2013. “The Democrats do fine in presidential elections; their problem is they can’t get out the vote in the midterm elections.”

She had disparaged Trump ahead of the 2016 election, remarks she later said were inappropriate.

But who would name her replacement was clearly on her mind during her final days.

Nina Totenberg, NPR’s Supreme Court correspondent and a longtime friend of Ginsburg’s, reported that the justice in recent days dictated a statement to her granddaughter Clara Spera: “My most fervent wish is that I will not be replaced until a new president is installed.”

Former vice president Joe Biden, the Democratic nominee for president, has said he would nominate the first African American woman to the Supreme Court if he is elected. Trump has said he needs at least one more nominee to cement conservative control of the court.

Another challenge to the landmark health-care law is on the court’s docket for the fall.

But Roberts demonstrated during the most recent term how he would play his position at the center of the court. He joined with the liberals to find that federal anti-discrimination law protects LGBTQ workers, and he put together coalitions on the court to reject Trump’s bold assertions that he could not be made to comply with subpoenas from congressional committees and a New York prosecutor for his personal financial records.

Similarly, Roberts wrote the opinion keeping the Trump administration from ending the program that protects undocumented immigrants brought to the United States as children, and the opinion in the ruling that stopped administration plans to add a citizenship question to the 2020 Census.

But he also sided with conservatives to provide important victories for religious conservatives. On the whole, he steered the court’s outcomes largely to mirror public opinion. A Gallup poll this summer showed public approval of the court at its highest level since 2009.

“Roberts is the most powerful chief justice since John Marshall,” said Harvard constitutional law professor Noah Feldman, referring to the fourth chief justice, who established the Supreme Court’s role in the federal government. “We haven’t had a chief who was genuinely the swing vote since Charles Evans Hughes [1930-1941], and even Hughes wasn’t always the swing vote.”

But another conservative appointment for Trump — or more if he is reelected in November — will change all that. Justice Stephen G. Breyer, the senior member of the remaining liberals, is 82.

Justices Clarence Thomas, 72, and Samuel A. Alito Jr., 70, consistently take positions more conservative than those of Roberts, who has shown he is more interested in preserving the court’s reputation as being above the partisan fray than in reaching the conservative outcomes he might personally favor.

For instance, in the term just completed, Roberts joined liberals in striking down a restrictive abortion law in Louisiana. It was the first time he had voted against abortion restrictions, but he said the outcome of the case was dictated by the court’s decision just a few years ago on a similar law in Texas.

But the rest of the court’s conservatives went the other way. There is little doubt that the antiabortion coalitions and evangelicals who are essential parts in Trump’s base will insist upon a nominee who will provide a conservative majority.