Ruth Bader Ginsburg, whose 27-year tenure as the second female justice on the U.S. Supreme Court culminated a legal career dedicated to advancing the rights of women, has died. She was 87.

She died due to complications of metastatic pancreatic cancer and was surrounded by her family at her home in Washington, the court said in a statement Friday. Ginsburg battled with five bouts of cancer.

Her death comes less than two months before an election and gives President Donald Trump a chance to try to shift the already conservative nine-member court further to the right by filling a third seat. Senate confirmation of his nominee would increase the chances of a decision overturning or severely curtailing the Roe v. Wade abortion-rights ruling.

Only days before her death, National Public Radio reported that Ginsburg dictated this statement to her granddaughter Clara Spera: “My most fervent wish is that I will not be replaced until a new president is installed.”

Senate Majority Leader Mitch McConnell has previously said the Senate would move to confirm any nominee this year, even though McConnell blocked President Barack Obama from having a hearing on his nomination of Merrick Garland in 2016. That set the stage for Trump to nominate Neil Gorsuch instead.

“Our nation has lost a jurist of historic stature. We at the Supreme Court have lost a cherished colleague,” Chief Justice John Roberts said in a statement. “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.”

Long before President Bill Clinton appointed her to the Supreme Court in 1993, Ginsburg argued cases before the court as a scholar and advocate of the women’s rights movement. She was a high-profile proponent of the unsuccessful effort to adopt an Equal Rights Amendment to the U.S Constitution.

On the court, she built a record as one of the most liberal members, supporting gay and abortion rights, President Barack Obama’s health-care law and restrictions on the death penalty.

Her strong dissents from rulings that cut back on voting rights and affirmative action won her the admiring nickname “Notorious R.B.G.” Two films about her were released in 2018: The documentary “RBG” and a Hollywood biography, “On the Basis of Sex.”

She drew criticism during the 2016 presidential campaign when she denounced Trump, who had clinched the Republican nomination, as a “faker” in a media interview. Ginsburg later said she regretted the comments. Trump called on her to resign, saying on Twitter that “her mind is shot.”

Ginsburg said she experienced gender discrimination personally when she tried, without success, to join New York City’s major law firms after being a star law student at Harvard and Columbia universities in the late 1950s.

Her experience was similar to that of the first female justice, Sandra Day O’Connor, a Ronald Reagan appointee who joined the court in 1981 and retired in 2006.

Battling Sexism

Ginsburg made her clearest mark on the Supreme Court when she was fighting what she saw as gender discrimination, often challenging her male colleagues on views she considered sexist.

When the court voted 5-4 in 2007 to uphold a federal ban on a late-term abortion procedure, Ginsburg took issue with the all-male majority’s professed concern that women might regret having an abortion and thus suffer a loss of self-esteem. Such thinking “reflects ancient notions about women’s place in the family and under the Constitution,” she wrote.

“I was a law school teacher,” she said during a 2015 interview at the court. “And that’s how I regard my role here with my colleagues, who haven’t had the experience of growing up female and don’t fully appreciate the arbitrary barriers that have been put in women’s way.”

Ginsburg wrote the court’s 7-1 decision in 1996 that ended the men-only admission policy at the state-funded Virginia Military Institute. In 2003, she joined the majority in upholding an affirmative action plan at the University of Michigan Law School, while dissenting from a second decision that overturned a race-conscious undergraduate admissions policy at the University of Michigan.

Same-Sex Marriage

In 2013, she was the first justice to officiate at a same-sex marriage, and two years later was part of the 5-4 majority that legalized gay marriage nationwide. She voted in two cases to uphold key provisions of the 2010 Affordable Care Act, and dissented from the 5-4 Citizens United ruling in 2010 that struck down decades-old restrictions on corporate campaign spending.

Since 2010, Ginsburg was the senior member of the court’s liberal wing, with the prerogative to write the main dissenting opinion.

She did just that in 2013, when a 5-4 court threw out a core part of the landmark Voting Rights Act of 1965, citing reduced incidents of discrimination as a reason. Ginsburg said the majority’s approach was “like throwing away your umbrella in a rainstorm because you are not getting wet.”

That dissent, and another one in an affirmative action case, inspired New York University law student Shana Knizhnik to create a Tumblr site dedicated to Ginsburg. She titled it Notorious R.B.G. -- a play on the late rapper Notorious B.I.G. -- offering T-shirts and an admiring book about Ginsburg.

Ginsburg became a devotee of the site. “I think it’s amusing,” she said in 2015. “It’s quite well done. There are some serious things on it. There are some funny things.”

Voting Record

In 2015 Ginsburg joined Justice Stephen Breyer in calling for the court to consider whether the death penalty is constitutional.

In the bitterly fought case that decided the 2000 presidential election for Republican George W. Bush, Ginsburg said in dissent that thousands of votes had not been counted.

In a 2009 interview with USA Today, Ginsburg said the Supreme Court needed more female justices. “Women belong in all places where decisions are being made,” said Ginsburg, who was the only woman on the high court from 2006, when O’Connor retired, to August 2009, when Sonia Sotomayor joined her. Elena Kagan raised the number of women on the court to three in 2010.

Ginsburg was one of the most durable justices in history. Before the liver tumor, she had contracted colon, lung and on two occasions pancreatic cancer, and she was hospitalized on multiple occasions for less serious ailments. Until 2019, when she was recovering from surgery to remove masses from one of her lungs, Ginsburg never missed an argument because of illness.

Ruth Joan Bader was born on March 15, 1933, in the Flatbush section of Brooklyn, New York. Her father, Nathan Bader, owned clothing stores. Her mother, the former Celia Amster, died of cervical cancer when Ruth was 17.

'Unsettling' Discrimination

In an interview for the PBS series “The Jewish Americans,” Ginsburg recalled her first experience with anti-Semitism, during a car trip with her parents: “There was a bed-and-breakfast and there was a sign outside and it read, ‘No dogs or Jews allowed.’ I had never seen that before. And that was obviously unsettling.”

At Cornell University in Ithaca, New York, she had a blind date with a classmate, Martin Ginsburg, and found him to be, as she later said, “the only young man I dated who cared that I had a brain.” They married after she graduated, first in her class, in 1954.

Ginsburg joined her husband as a student at Harvard Law School in Cambridge, Massachusetts, where “women were not looked upon as people who should be there,” she later told the New York Times.

She finished legal studies at the top of her class at Columbia Law School after her husband got a job in New York City. At both Harvard and Columbia, she won election to the law review. Unable to land a job with a major law firm, she clerked for a federal district judge.

Breaking Tradition

“The traditional law firms were just beginning to turn around on hiring Jews,” she later wrote. “But to be a woman, a Jew and a mother to boot -- that combination was a bit too much.”

In 1963, she joined the faculty at Rutgers University School of Law in New Jersey. In 1972, Columbia Law School made her the first female tenured professor in its 114-year history, and she became the first director of the American Civil Liberties Union’s Women’s Rights Project.

At the ACLU, Ginsburg became a leading practitioner before the Supreme Court, planning and arguing sex-discrimination cases that cumulatively established for the first time that discrimination against women was banned by the Constitution’s equal-protection clause.

Step by gradual step, sometimes using men as the lead client, Ginsburg challenged unequal treatment of men and women in six cases, winning five. Her steady, incremental assault brought comparisons to how Thurgood Marshall challenged racial discrimination in the years before he joined the Supreme Court.

Survivor Benefits

In one early win, Ginsburg helped argue the case of a female Air Force lieutenant whose husband was denied the housing allowances and medical benefits automatically given to military wives. In another case, she successfully represented a man seeking survivor benefits from Social Security after his wife died in childbirth, leaving him to raise his infant son. A subsequent case also won by Ginsburg extended the survivor benefits to all widowers, regardless of whether they had children.

President Jimmy Carter appointed her to the U.S. Court of Appeals for the D.C. Circuit in 1980. In 13 years on that court, Ginsburg staked out the center as a swing vote who sided not infrequently with her Republican colleagues.

Justice Byron White’s announcement in March 1993 that he would retire gave Democrats their first Supreme Court pick in more than 25 years.

The Senate confirmed Ginsburg 96-3. She offered a straightforward response when asked at her Senate hearing about abortion, saying the Constitution’s equal-protection guarantee assured women “that she be the decision maker, that her choice be controlling” on such matters.

Friendship With Scalia

On the court she was known for working long hours, often working from home until well past midnight, and for her collegiality, continuing a close friendship with her ideological opposite on the court, Justice Antonin Scalia. Opera lovers, they appeared together as extras in Washington National Opera productions, and they were photographed riding an elephant together in India. Scalia died in 2016.

Ginsburg and her husband, who died in 2010, had two children, Jane, a professor at Columbia Law School, and James, a producer of classical music recordings.