WASHINGTON, D.C. — In a 5-4 ruling June 30, the Supreme Court said the exclusion of religious schools in Montana’s state scholarship aid program violated the federal Constitution.

In the opinion, written by Chief Justice John Roberts, the court ruled that if a state offers financial assistance to private schools, it has to allow religious schools to also take part. Separate dissents were written by Justices Ruth Bader Ginsburg, Stephen Breyer and Sonia Sotomayor.

Roberts said the decision by the Montana Supreme Court to invalidate the school scholarship program because it would provide funding to both religious schools and secular schools “bars religious schools from public benefits solely because of the religious character of the schools.”

“The provision also bars parents who wish to send their children to a religious school from those same benefits, again solely because of the religious character of the school,” he wrote.

The U.S. Conference of Catholic Bishops said the court “rightly ruled that the U.S. Constitution does not permit states to discriminate against religion. This decision means that religious persons and organizations can, like everyone else, participate in government programs that are open to all.”

The statement from Archbishop Thomas G. Wenski of Miami, chairman of the USCCB’s Committee for Religious Liberty, and Bishop Michael C. Barber, of Oakland, California, chairman of the USCCB’s Committee on Catholic Education, also said the decision was “good news, not only for people of faith, but for our country.”

“A strong civil society needs the full participation of religious institutions,” the statement said. “By ensuring the rights of faith-based organizations’ freedom to serve, the court is also promoting the common good.”

Advocates for school choice also praised the decision. “The weight that this monumental decision carries is immense, as it’s an extraordinary victory for student achievement, parental control, equality in educational opportunities and First Amendment rights,” said Jeanne Allen, founder and chief executive of the Center for Education Reform.

The case, Espinoza v. Montana Department of Revenue, was brought to the court by three Montana mothers who had been sending their children to Stillwater Christian School in Kalispell with the help of a state scholarship program.

The program, created in 2015, was meant to provide $3 million a year for tax credits for individuals and business taxpayers who donated up to $150 to the program. It was helping about 45 students and just months after it got started, the Montana Department of Revenue issued an administrative rule saying the tax credit donations could only go toward nonreligious, private schools — explaining the use of tax credits for religious schools violated the state’s constitution.

The mothers were represented by the Institute for Justice, a nonprofit legal advocacy group based in Virginia. In 2015, these mothers sued the state saying that barring religious schools from the scholarship program violated the federal constitution. The trial court agreed with them, but the Montana Supreme Court reversed this decision.

The court based its decision on the state constitution’s ban on funding religious organizations, called the Blaine Amendment.

Thirty-seven states have Blaine amendments, which prohibit spending public funds on religious education. These bans date back to the 19th century and are named for Rep. James Blaine of Maine, who tried unsuccessfully in 1875 to have the U.S. Constitution prohibit the use of public funds for “sectarian” schools.

In oral arguments, Justice Brett Kavanaugh said the amendments reflected “grotesque religious bigotry” against Catholics. Adam Unikowsky, Montana’s attorney, argued that the state’s revised constitution in 1972 does not have “evidence whatsoever of any anti-religious bigotry.”

The USCCB’s June 30 statement said the court “dealt a blow to the odious legacy of anti-Catholicism in America,” stressing that Blaine Amendments “were the product of nativism and bigotry” and were “never meant to ensure government neutrality toward religion but were expressions of hostility toward the Catholic Church.”

Justice Samuel Alito, in a concurring opinion in the case, highlighted the anti-Catholic origins of state Blaine amendments like the one in Montana and he even included an 1871 political cartoon from the political magazine Harper’s Weekly to show the bigotry toward Catholics at the time. The cartoon depicts priests as crocodiles slithering toward children in the U.S. as a public school crumbles in the background.

The USCCB also filed a friend-of-the-court brief, along with several other religious groups, in support of the plaintiffs, which said: “Families that use private schools should not suffer government discrimination because their choice of school is religious.”

A group of Montana Catholic school parents also submitted a friend-of-the-court brief stressing that state Blaine amendments “should be declared unconstitutional once and for all.”

Before the case was argued, Richard Garnett, director of the University of Notre Dame’s Program on Church, State and Society, said it could have major implications for education-reform debates and policies and it “could remove, or at least reduce, one of the legal barriers to choice-based reforms like scholarship programs and tax credits for low-income families.”