U.S. Supreme Court Justice Ruth Bader Ginsburg said she regrets criticizing Republican presidential candidate Donald Trump, calling her remarks over the past week “ill-advised” and vowing to be more careful in the future.

Ginsburg had drawn rebukes for calling Trump “a faker” and saying she didn’t want to think about the possibility he might be elected. Legal-ethics experts said the comments, made in media interviews, might undermine the court’s authority. Trump had called for Ginsburg to resign.

“On reflection, my recent remarks in response to press inquiries were ill-advised and I regret making them,” Ginsburg said in a statement issued by the court. “Judges should avoid commenting on a candidate for public office. In the future I will be more circumspect.”

Ginsburg, the 83-year-old leader of the court’s liberal wing, made the remarks about Trump at the end of a Supreme Court term highlighted by victories for affirmative action and abortion rights.

The court is a major issue in the race between Trump and Democrat Hillary Clinton. The vacancy left by Justice Antonin Scalia’s Feb. 13 death remains unfilled, and Ginsburg will be one of three justices 78 or older on Election Day.