Chief Justice John G. Roberts Jr. issued a rare rebuke of a sitting member of Congress on Wednesday, chastising the Senate’s top Democrat, Minority Leader Charles E. Schumer, for saying at a rally outside the Supreme Court that President Trump’s two nominees to the court would “pay the price” for a vote against abortion rights.

In a highly unusual statement issued by the court, the chief justice recounted comments Schumer (N.Y.) had directed at Neil M. Gorsuch and Brett M. Kavanaugh and said: “Justices know that criticism comes with the territory, but threatening 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.”

Schumer, speaking to abortion rights supporters Wednesday morning as the Supreme Court heard arguments in an important abortion case from Louisiana, called out the two by name.

“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. “You won’t know what hit you if you go forward with these awful decisions.”

The whirlwind was just beginning. Pugilistic Republicans and Democrats raced from their respective corners, led by the president, who wrote on Twitter: “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!”

Later, Trump tweeted about the matter again with a threat similar to the one Schumer was being criticized for making.

“He must pay a severe price for this!” Trump wrote.

The GOP denounced Schumer and criticized the media for what they said was a lack of outrage. Democrats demanded to know why Roberts had not spoken out last week when Trump singled out liberal Justices Ruth Bader Ginsburg and Sonia Sotomayor for criticism, or why he did not defend the federal judge Trump denounced for her oversight of the trial of the president’s friend Roger Stone.

The episode underscored the partisan politics that have engulfed the fight over the judiciary, which is supposed to be the nonpartisan branch of the government.

On the Republican side, House Minority Whip Steve Scalise (R-La.) shared a snippet of Schumer’s remarks on Twitter, with a red siren icon, calling Schumer “unhinged.”

“Enough. This rhetoric has dangerous consequences. Where’s the media outrage?” he tweeted.

Sen. Ben Sasse (R-Neb.) shared similar thoughts.

“Think about this, if a Republican threatened Justice Sotomayor or Justice Ginsburg, it would be the biggest story not just in Washington but all across America,” Sasse said in a statement.

“But, Chuck Schumer’s bully tactics aren’t getting much air time right now because there’s so many people in bed with his defense of abortion and his attack on an independent judiciary,” Sasse continued.

On the left, Brian Fallon of the liberal nonprofit organization Demand Justice, said: “It takes a certain amount of chutzpah for John Roberts to condemn these comments by Chuck Schumer after saying nothing when President Trump attacked two Democratic-appointed justices just last month.”

Schumer’s remarks came during the circuslike atmosphere that plays out in front of the Supreme Court whenever it hears a controversial case, especially abortion. As protesters from both sides of the issue crowded the sidewalk, Schumer spoke to abortion rights supporters.

“We stand here today because behind me, inside the walls of this court, the Supreme Court is hearing arguments for the first major abortion rights case since Justices Kavanaugh and Justice Gorsuch came to the bench,” Schumer said, as his mention of the justices drew boos from the crowd.

“We know what’s at stake. Over the last three years, women’s reproductive rights have come under attack in a way we haven’t seen in modern history.”

After his comments in which he said Gorsuch and Kavanaugh would “pay the price,” Schumer added: “We will tell President Trump and Senate Republicans who have stacked the courts with right-wing ideologues that you’re going to be gone in November, and you’ll never be able to do what you’re trying to do now ever, ever again. You hear that over there on the far right? You’re gone in November.”

Schumer’s comment that Gorsuch and Kavanaugh had “released the whirlwind, and you will pay the price,” seemed to recall Kavanaugh’s testimony to Democrats in 2018 on the Senate Judiciary Committee after he was accused of having committed sexual assault as a teenager.

“You sowed the wind for decades to come,” Kavanaugh said. “I fear that the whole country will reap the whirlwind.”

Justin Goodman, a spokesman for Schumer, did not answer a question about whether the similarities in the senator’s comments were intentional, but he said Schumer was not threatening the justices with violence.

“Senator Schumer’s comments were a reference to the political price Senate Republicans will pay for putting these justices on the court, and a warning that the justices will unleash a major grass-roots movement on the issue of reproductive rights against the decision,” Goodman said.

“For Justice Roberts to follow the right wing’s deliberate misinterpretation of what Senator 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.”

The reference was to Roberts’s testimony at his confirmation hearing in 2005, during which he compared judges to umpires.

Roberts is generally reluctant to comment when politicians criticize the court or other members of the federal judiciary. He made an exception in November 2018 after Trump denounced an “Obama judge” who had ruled against the administration.

“We do not have Obama judges or Trump judges, Bush judges or Clinton judges,” Roberts said in a statement issued by the court. “What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them. That independent judiciary is something we should all be thankful for.”

The chief justice, who earlier this year presided over Trump’s impeachment trial in the Senate, learned that the president often has the last word.

“Sorry Chief Justice John Roberts, but you do indeed have ‘Obama judges,’ and they have a much different point of view than the people who are charged with the safety of our country,” Trump tweeted in response.

Roberts has been reluctant to enter the fray since then.

He declined a request for comment after Trump cranked out six blasts about the handling of Stone’s sentencing, including one that targeted U.S. District Judge Amy Berman Jackson, who presided over the case.

Last month, in tweets and comments at a news conference in India, Trump called on Sotomayor and Ginsburg to recuse themselves from any cases that were “Trump-related.”

He interpreted as biased a dissent from Sotomayor about his administration’s tendency to seek emergency interventions from the Supreme Court and reminded Ginsburg of remarks she made about him as a candidate in 2016, for which she has expressed regret.

Through a court spokeswoman, Roberts, Sotomayor and Ginsburg declined to respond to Trump’s comments.

Seung Min Kim and Alice Crites contributed to this report.