PRINCETON, N.J. — At a forum at their alma mater on Friday, Supreme Court Justices Elena Kagan and Sonia Sotomayor worried about how the bitter partisan battle over the nomination of Brett M. Kavanaugh will affect the high court’s reputation.

“Part of the court’s strength and part of the court’s legitimacy depends on people not seeing the court in the way that people see the rest of the governing structures of this country now,” Kagan told the audience at Princeton University, “in other words, people thinking of the court as not politically divided in the same way, as not an extension of politics, but instead somehow above the fray, even if not always and in every case.”

Even if the court splits 5 to 4 on the nation’s most important issues, Sotomayor said, it is important for the public to see that doesn’t create animosity among the nine justices.

“We have to rise above partisanship in our personal relationships,” she said. “We have to treat each other with respect and dignity and with a sense of amicability that the rest of the world doesn’t often share.”

Sotomayor was nominated to the court in 2009 by President Barack Obama, who nominated Kagan the following year.

With Kavanaugh set to replace retiring Justice Anthony M. Kennedy, the court will now have five consistent conservatives, all nominated by Republican presidents, and four consistent liberals nominated by Democratic presidents. Kagan wondered if anyone will play the role in the middle that the court has had in the past.

“I think it’s been an extremely important thing for the court that in the last, really, 30 years, starting with Justice [Sandra Day] O’Connor and continuing with Justice Kennedy, there has been a person who people found [to represent] the center, who people couldn’t predict in that sort of way,” Kagan said. “And that’s enabled the court to look as though it was not owned by one side or another, and was indeed impartial and neutral and fair."

Kagan added: “It’s not so clear, I think, going forward, that that sort of middle position — it’s not so clear whether we’ll have it.”