Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WASHINGTON — Chief Justice John Roberts publicly chastised Senate Minority Leader Chuck Schumer on Wednesday over comments Schumer made outside the Supreme Court as the justices were hearing a case on abortion rights.

Schumer, D-N.Y., suggested that President Donald Trump's court appointees, Neil Gorsuch and Brett Kavanaugh, "won't know what hit" them if they vote to uphold abortion restrictions. He spoke during a rally on the sidewalk in front of the court building.

"I want to tell you, Gorsuch, I want to tell you, Kavanaugh, you have released the whirlwind, and you will pay the price," Schumer said.

In a highly unusual written statement issued late Wednesday, Roberts said, "Statements of this sort from the highest levels of government are not only inappropriate, they are dangerous."

"All members of the Court will continue to do their job, without fear or favor, from whatever quarter," Roberts said.

Download the NBC News app for breaking news and politics

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Schumer's spokesman said his remarks about Gorsuch and Kavanaugh referred to the political price Republicans "will pay for putting them on the court."

It was a warning, the spokesman said, "that the justices will unleash major grassroots movement on the issue of reproductive rights against the decision."

Senate Majority Leader Mitch McConnell, R-Ky., plans to blast Schumer in a specch on the Senate floor on Thursday.

"Contrary to what the Democratic leader has tried to claim, he very clearly was not addressing Republican lawmakers or anybody else," McConnell will say, according to excerpts of his remarks released ahead of the speech. "He literally directed the statement to the justices, by name. And he said, quote, 'if you go forward with these awful decisions,' which could only apply to the court itself. The minority leader of the United States Senate threatened two associate justices of the U.S. Supreme Court. Period."

The court was hearing a challenge to a Louisiana law requiring doctors who perform abortions to have admitting privileges at nearby hospitals. It was the first major abortion case to reach the Supreme Court since the retirement of Anthony Kennedy, who voted to uphold a woman's right to choose. He was replaced by Kavanaugh, who is generally more conservative.

Schumer told the crowd that state legislatures are waging a war on women by passing tough abortion laws.

Schumer's office later issued a second statement on Wednesday in which the senator criticized Roberts.

"For Justice Roberts to follow the right wing's deliberate misinterpretation of what Sen. Schumer said, while remaining silent when President Trump attacked Justices Sotomayor and Ginsburg last week, shows Justice Roberts does not just call balls and strikes," said Schumer spokesman Justin Goodman, referring to Trump's criticism of the two liberal justices and his call for them not to participate in any rulings involving him.

Trump also slammed Schumer saying his comments were a "direct and dangerous" threat to Supreme Court justices.

This is a direct & dangerous threat to the U.S. Supreme Court by Schumer. If a Republican did this, he or she would be arrested, or impeached. Serious action MUST be taken NOW! https://t.co/WqQUbyzaJU — Donald J. Trump (@realDonaldTrump) March 5, 2020

There can be few things worse in a civilized, law abiding nation, than a United States Senator openly, and for all to see and hear, threatening the Supreme Court or its Justices. This is what Chuck Schumer just did. He must pay a severe price for this! — Donald J. Trump (@realDonaldTrump) March 5, 2020

Roberts has often said in public appearances that he believes it is mistaken to assume that federal judges act out of their own partisan political interests. In 2018, he notably responded to Trump's criticism of a federal judge as "an Obama judge."

"We do not have Obama judges or Trump judges, Bush judges or Clinton judges," Roberts said then. "What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them."