The U.S. Supreme Court must guard its image of being fair and impartial or it risks losing its legitimacy in an era of extreme political polarization, Justice Elena Kagan said Friday on the eve of a controversial vote that could reshape the court for a generation.

In an appearance with Justice Sonia Sotomayor at Princeton University, Kagan said the court's strength has been the perception that it can stay "above the fray."

"It's an incredibly important thing for the court to guard, is this reputation of being fair, of being impartial, of being neutral, and not being simply an extension of the terribly polarized political process and environment that we live in," Kagan said.

She added that the court has long had at least one justice who is seen as the ideological center and could vote either way.

"Going forward, that sort of middle position ... it's not so clear we will have it," Kagan said.

Sotomayor agreed with Kagan and added that justices must "rise above partisanship" in a their personal relationships.

The justices, both Princeton alumna, were speaking as part of the university's She Roars conference, a weekend of celebrating women at Princeton. Though neither was directly asked about the nomination of Judge Brett Kavanaugh, their comments come amid a bare-knuckle political fight over his nomination and concerns about both his temperament and ability to set aside the bitter partisanship surrounding his nomination.

Earlier Friday, Democrats pleaded with Republicans who control the Senate to reject Kavanaugh's nomination. If the allegations of sexual assault made against him don't disqualify him, his partisan and often combative testimony before senators last week should, they argued.

But the Senate pushed forward with Kavanaugh's approval seemingly assured, and his nomination was expected to get a final vote Saturday.

Asked about political divisions, Kagan said Supreme Court justices must realize how precious the court's legitimacy is.

"We don't have an army, we don't have any money, the only way we get people to do what we say that they should do is because people respect us and respect our fairness," Kagan said. "I think especially in this time when the rest of the political environment is so divided, every single one of us has an obligation to think about what it is that provides the court with its legitimacy."

Kagan and Sotomayor, both appointed by President Barack Obama, spoke to a crowd of about 3,000 Princeton students and alumni shortly after it became clear that several key senators will endorse Kavanaugh.

They discussed their own journeys to the Supreme Court, including their time at Princeton, and addressed the challenges women face in the workplace.

"I don't believe that you can be part of the working world without having a moment or a story, if not more than one, about being treated differently because you are a woman," Sotomayor said.

She recalled being invited to the "guys' poker games", organized in part by former Justice Antonin Scalia.

"It took them a while to invite me, and I think they were very happy when I said no," Sotomayor joked.

As the audience laughed, Kagan cut in: "I was never invited, actually," she said.

Yet Sotomayor stressed that there have always been men of good will who mentored her in each phase of her career, including on the Supreme Court. Both justices spoke of their positive personal relationships with conservative justices.

"No matter how hostile an environment may seem, you have to look around for those people who will come and stand with you and by you, because they are there," Sotomayor said.

"We still have a long way to go," she added, "but it's a lot shorter distance than when I started."

Adam Clark may be reached at adam_clark@njadvancemedia.com. Follow him on twitter at @realAdamClark. Find NJ.com on Facebook.