The judge said he was surprised at the criticism. “I feel like church is important,” he said. “I sentenced him to go to church for 10 years because I thought I could do that.”

He added, “I am satisfied that both the families in this case think we’ve made the right decision,” and noted that the dead boy’s father had tearfully hugged Mr. Alred in the courtroom. If Mr. Alred stops attending church or violates any other terms of his probation, Judge Norman said, he will send him to prison.

As for the constitutionality of his ruling, Judge Norman said, “I think it would hold up, but I don’t know one way or another.”

Judge Norman did not specify which religious denomination Mr. Alred must follow. But he also said: “I think Jesus can help anybody. I know I need help from him every day.”

Randall T. Coyne, a professor of criminal law at the University of Oklahoma, agreed that the judge’s church requirement was unconstitutional. But unless the defendant fights the ruling, he said, civil liberties advocates have no way to challenge it in court, leaving the complaint to the judicial review agency as their only option.

Over the years, several judges around the country have mandated church attendance as part of sentences, sometimes stirring criticism. In the early 1990s in Louisiana, Judge Thomas P. Quirk ordered hundreds of defendants in traffic and misdemeanor cases to attend church once a week for a year. The judge said that he had imposed the condition only on people who agreed to it, and that it provided a good alternative to sending defendants to overcrowded jails or imposing fines they could not afford.