NEW YORK — A federal judge on Friday blocked New York state from enforcing coronavirus restrictions limiting indoor religious gatherings to 25 percent capacity when other types of gatherings are limited to 50 percent.

Judge Gary Sharpe enjoined Gov. Andrew Cuomo, New York City Mayor Bill de Blasio and Attorney General Letitia James from enforcing some of the capacity restrictions put in place by executive order to contain the spread of the virus.

The plaintiffs’ religious activities “will be burdened and continue to be treated less favorably than comparable secular activities,” Sharpe said in his 38-page ruling from Albany.

The plaintiffs, two  priests of the breakaway Society of St. Pius X from upstate New York and three Orthodox Jewish congregants from Brooklyn, argued that the restrictions violated their First Amendment rights to practice their religion.

The plaintiffs said the restrictions forced Father Steven Soos and Father Nicholas Stamos to either turn away parishioners who wished to attend Mass “or to hold more Masses per day than are possible.”

Christopher Ferrara, an attorney for the plaintiffs, called the unequal restrictions “an irrational targeting of houses of worship.”

“The idea that houses of worship are some deadly viral vector unlike anything else is just superstition,” Ferrara said in a telephone interview. “There’s no science to support that.”

Restrictions limiting the number of people who can attend outdoor religious gatherings will also be lifted by the injunction.

The New York State Catholic Conference said New York bishops were not involved in the lawsuit. But spokesman Dennis Poust said he anticipated that “our churches will continue to voluntarily follow state guidelines as a matter of prudential judgment.”

The judge noted that both Cuomo and de Blasio have expressed approval for protests against racism and police brutality that followed the death of George Floyd in Minneapolis last month while continuing to support restrictions on religious gatherings.

“Governor Cuomo and Mayor de Blasio could have just as easily discouraged protests, short of condemning their message, in the name of public health and exercised discretion to suspend enforcement for public safety reasons instead of encouraging what they knew was a flagrant disregard of the outdoor limits and social distancing rules,” he said.

The Department of Justice called the decision “a win for religious freedom and the civil liberties of New Yorkers.”

“The court’s decision is consistent with positions and arguments made by the United States Department of Justice in similar filings and letters, including in New York City and elsewhere around the country,” said Assistant Attorney General Eric Dreiband of the Civil Rights Division in a statement.

“The Department of Justice will continue to support people of faith who seek equal treatment against threats and actions by public officials who discriminate against them because of their religion.”

A spokesperson for Cuomo said the governor’s office will review the decision. A spokesperson for the New York City law department said, “We will review this new ruling and work with the state on next steps.”