Ruth Bader Ginsburg. Getty Images Supreme Court Justice Ruth Bader Ginsburg said on Thursday that she regretted attacking Republican presidential candidate Donald Trump in a series of media interviews throughout the past week.

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

She added: "Judges should avoid commenting on a candidate for public office. In the future I will be more circumspect."

The apology came after Ginsburg took heat from all sides of the political spectrum for the recent criticism of the presumptive Republican nominee.

Both The New York Times and The Washington Post skewered Ginsburg, with The Times publishing an editorial on Wednesday declaring Trump to be "right" in the war of words.

"Washington is more than partisan enough without the spectacle of a Supreme Court justice flinging herself into the mosh pit," The Times' editorial board wrote.

Ginsburg ignited controversy when she made a series of remarks in recent days to the Associated Press, The Times, and CNN about the Trump candidacy. They were rare if not unprecedented remarks from a sitting Supreme Court justice on a presidential candidate.

"At first I thought it was funny," she told CNN on Tuesday of Trump's presidential bid. "To think that there's a possibility that he could be president ... I think he has gotten so much free publicity."

Trump went off on Ginsburg after, calling on her to resign and firing off a series of blistering tweets aimed at the justice.

"If I win the Presidency, we will swamp Justice Ginsburg with real judges and real legal opinions!" he posted Wednesday evening.