Protests spread in Kathua. Dozens of Hindu women organized hunger strikes and threatened to set themselves on fire if the case proceeded. At one point, a mob of Hindu lawyers physically blocked police officers from entering a courthouse to file charges against the men.

Several prominent members of the governing Hindu nationalist Bharatiya Janata Party also pushed to move the case from the state police to the Central Bureau of Investigation, a strategy that was perceived by many as an attempt to win leniency for the accused. (The C.B.I. falls under the purview of the central government.)

Reacting to Monday’s verdict, Sarah Jacob, an anchor on NDTV, an Indian news channel, said that the case’s handling had all the elements of a “bad horror movie.”

“Every single loophole that could have been abused has been abused,” she said. “This is not just a victory for the family of that 8-year-old girl. It’s a victory of the legal system in our country.”

A special court in the state of Punjab handed down the verdict, which was based on testimony from more than 100 witnesses. Before the hearing, the police tightened security by deploying several hundred officers around the building and by bringing in a tank. There were no reports of violence.

Three of the men, including Mr. Ram, were convicted on charges of kidnapping, rape and murder, and sentenced to life imprisonment. The others were found guilty of destroying evidence and given five years in jail. The court acquitted Mr. Ram’s son, Vishal. All of the men were tried under laws that could have brought the death penalty.

Among members of the girl’s community, who are on their way to Kashmir for the summer, many expressed relief and joy when they heard the verdict, though some wondered if the sentences were strong enough. The girl’s father said that his wounds were as fresh today as when the crime occurred.

“I will say justice is done on the day I hear these beasts hanged,” he said by telephone. “In her, I had a new life, a reason to live. That reason to live is gone.”