WASHINGTON — The Supreme Court seemed prepared Wednesday to rule that states violate the U.S. Constitution if they prevent religious schools from receiving some state benefits.

During an hour of courtroom argument, the court's conservatives indicated they were inclined to lower somewhat the wall of separation between church and state. If that's how the court rules, it could affect laws or constitutional provisions in 37 states that currently bar public funding for schools and churches.

The case involved a Montana program launched in 2015 to provide tax credits for people and businesses that donate to private schools. The organizations that receive the contributions then give financial aid to parents, who decide which private schools their children should attend.

But shortly after it was launched, a state agency barred any of the scholarship money from ending up at religious schools. It cited a provision of the Montana Constitution that prohibits "any direct or indirect appropriation or payment ... to aid any church, school ... controlled in whole or in part by any church."

Three mothers from low-income families went to court to challenge the restriction. One of them, Kendra Espinoza, uses the scholarship money to send her two daughters to Stillwater Christian School in Kalispell, holding yard sales to help afford the payments.

The Montana Supreme Court ruled that the scholarship program violated the state Constitution, so it struck down the entire law, eliminating the payments for both religious and secular schools. For that reason, the state's lawyer told the Supreme Court on Wednesday that there's no longer any discrimination since all private schools are treated the same.

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

Richard Komer of the Institute for Justice, representing the mothers, told the court Wednesday that the question "is whether the U.S. Constitution allows the wholesale exclusion of religious schools from a state scholarship program. It does not."

Some of the court's liberals wondered what there was to sue about, since the state court eliminated the entire program. "Everyone's now in the same boat, since now no money will go to either religious or nonreligious schools. So there's no discrimination going on now, is there?" Justice Elena Kagan asked.

But the court's conservatives suggested that Montana acted with a discriminatory purpose when it shut down the program solely because it gave money to religious schools. Justice Brett Kavanaugh said it would be equally discriminatory to single out certain faiths.

"What if the state said you can use scholarship funds for private schools, but not for Jewish or Protestant schools? Wouldn't that be discrimination?" he asked.

The best hope for the state appeared to be the possibility that Chief Justice John Roberts might not join his fellow conservatives because he might conclude that the mothers did not have the proper legal standing to bring the case. "The claimed injury here is to the schools, but we don't have the schools before us in this case," he said.

The legal battle requires the justices to strike a balance between the desire of a state to keep government out of religion and the claims of residents that religious faith should not freeze them out of state programs intended to help everyone.

Komer said another decision by the Supreme Court three years ago is heavily in the mothers' favor. In that ruling, the court said that Missouri was wrong to exclude a Lutheran church from a state program intended to help nonprofits cover their gravel playgrounds with a safer rubber surface.

Arguing for Montana, Adam Unikowsky said the disputed provision of its state Constitution was revised in 1972 and was based on a concern that diverting funds from public schools would tend to weaken the system in favor of schools established for private or religious purposes.

But Kavanaugh said the provision, originally adopted in 1889, had its origin in a wave of nationwide anti-Catholic sentiment, describing measures of that type as being "rooted in grotesque religious bigotry against Catholics."

Espinoza, one of the mothers in the Montana case, said she believes so strongly in the Christian school her daughters attend that she works two jobs to afford the private school tuition.

"I chose that school because of the Christian-based education. It comes with a lot more of the values that I want to teach my children," she told NBC News in an interview. "If the scholarships are available, why should we be denied as opposed to another family that chooses a different school for their children?" She was in the courtroom for Wednesday's argument.

The Supreme Court has never drawn a bright line between acceptable and prohibited public aid for religious programs. In the Missouri playground case, it was careful to say the ruling was only about playgrounds, not broader support to the church's religious mission.

In a 2004 ruling, the court upheld Washington state's program awarding college scholarships to students who attended religious schools, as long as they were not preparing to become members of the clergy.

The court will decide the case by late June.