Former President Obama late Friday called Supreme Court Justice Ruth Bader Ginsburg a “warrior for gender equality” and someone who believed justice “only had meaning if it applied to every single American."

Ginsburg, the second woman named to the Supreme Court and the longest-serving woman in its history, lost her battle with cancer earlier Friday. She was 87.

“Justice Ginsburg helped us see that discrimination on the basis of sex isn’t about an abstract ideal of equality; that it doesn’t only harm women; that it has real consequences for all of us,” Obama wrote in a post on Medium. “It’s about who we are — and who we can be.”

Obama wrote that he and his wife, former first lady Michelle Obama, “admired her greatly, we’re profoundly thankful for the legacy she left this country, and we offer our gratitude and our condolences to her children and grandchildren tonight.”

TRUMP REACTS TO RUTH BADER GINSBURG'S DEATH, SAYS JUSTICE 'LED AN AMAZING LIFE' 

Then-President Barack Obama hugs Supreme Court Justice Ruth Bader Ginsburg on Capitol Hill in Washington, prior to his State of the Union address, Jan. 25, 2011. From left are Chief Justice John Roberts, Justice Anthony Kennedy, Obama, Justice Ginsburg and Justice Stephen Breyer. (Associated Press)

Then-President Barack Obama hugs Supreme Court Justice Ruth Bader Ginsburg on Capitol Hill in Washington, prior to his State of the Union address, Jan. 25, 2011. From left are Chief Justice John Roberts, Justice Anthony Kennedy, Obama, Justice Ginsburg and Justice Stephen Breyer. (Associated Press)

Ginsburg was an important liberal voice on the court, in both her dissents and victories, like the landmark 5-4 decision in 2015, during Obama's second term, on Obergefell v. Hodges, which gave same-sex couples the right to marry.

Noting Ginsburg’s dying wish that she “not be replaced until a new president is installed,” Obama commented on Senate Majority Leader Mitch McConnell’s standard from 2016 that voters should have a say when a Supreme Court vacancy opens soon before an election -- with the nominee named by the election winner, not the sitting president.

“A basic principle of the law — and of everyday fairness — is that we apply rules with consistency, and not based on what’s convenient or advantageous in the moment,” Obama said.

McConnell didn’t allow a hearing or a vote on Obama’s nomination of Merrick Garland before the 2016 election, so newly inaugurated President Trump was able to appoint Neil Gorsuch to the high court after taking office in 2017.

CLICK HERE TO GET THE FOX NEWS APP

In closing, Obama wrote, “The questions before the Court now and in the coming years — with decisions that will determine whether or not our economy is fair, our society is just, women are treated equally, our planet survives, and our democracy endures — are too consequential to future generations for courts to be filled through anything less than an unimpeachable process.”