WASHINGTON — Supreme Court Justice Ruth Bader Ginsburg apologized Thursday for “ill-advised” public criticism of Donald Trump, promising to be more discreet in the future.

The leader of the court’s liberal wing sought to quiet complaints that she crossed a line in her remarks about Trump, saying in a statement that judges should not comment on candidates for public office.

“On reflection, my recent remarks in response to press inquiries were ill-advised and I regret making them,” the 83-year-old justice said.

Ginsburg told The Associated Press last week that she did not want to think about the prospect of the Republican winning the presidency over Democrat Hillary Clinton. She escalated her criticism in subsequent media interviews, including calling Trump a “faker” who “really has an ego,” in a CNN interview.

Trump jumped into the fray on Wednesday. He tweeted that Ginsburg was an embarrassment for making “very dumb political statements about me. Her mind is shot – resign!” In subsequent tweets, Trump called Ginsburg “incompetent” and wondered whether she would apologize.

Other Republicans have chimed in, including Senate Majority Leader Mitch McConnell of Kentucky, who called Ginsburg’s remarks “totally inappropriate.”

“She oughta stay out of it,” said Senate Judiciary Committee Chairman Chuck Grassley, R-Iowa. “It hurts the court when she does that.”

Ginsburg was appointed to the high court in 1993 by Clinton’s husband, former President Bill Clinton. She said in the AP interview that she expects the next president, “whoever she will be,” probably will have several Supreme Court appointments. Two other justices in their late 70s, Stephen Breyer and Anthony Kennedy, also could retire in the next few years.

More: Donald Trump demands Justice Ginsburg resign for calling him a ‘faker’