JAFFNA, Sri Lanka —It began as a feel-good story about a stray dog that captivated thousands of Hindu pilgrims across Sri Lanka. It ended with a Sri Lankan migrant worker from the eastern town of Kalmunai being sentenced to five years in a Saudi prison over a single comment on Facebook.
The worker, identified by his family as Anojan, a Sri Lankan Tamil employed in the kingdom, was sentenced on Sunday after posting a Facebook comment that Saudi authorities deemed insulting to the Prophet Muhammad. The court also imposed a fine of three million Sri Lankan rupees, or roughly $9,000, relatives said.
News of the verdict emerged through Rajiv Kumar Rajeevkanth, a Sri Lankan social activist, who said in a video posted online that he had spoken by telephone with Anojan's brother shortly after the ruling. The family told him that Anojan had been sentenced to five years and fined three million rupees, Mr. Rajeevkanth said, adding that the man's mother and other relatives could be heard weeping during the call.
The case grew out of an improbable chain of events set in motion during this year's Pada Yatra, the two-month Hindu pilgrimage that each year draws devotees from Sri Lanka's Northern Province to the shrine of Kataragama, in the island's deep south, dedicated to the deity Murugan.

Along the route, a stray dog attached itself to the pilgrims and would not leave. Moved by its persistence, devotees named it Subramani, another name for Murugan, and fed it a vegetarian diet of biscuits, bread, milk and rice. Videos of the animal padding alongside the procession for hundreds of miles spread quickly online, and many pilgrims came to regard it as a symbol of faith and endurance.
The mood shifted in the eastern town of Kalmunai, where a young Muslim man was filmed kicking the dog. The footage circulated widely and drew broad condemnation, including from Muslim religious leaders. The man was arrested, apologized and was released on bail.
The online anger did not stop there. As the argument spread across social media, abusive posts aimed at religious communities appeared on both sides. Among them, Anojan's family said, was the comment that Saudi authorities treated as an insult to the Prophet.
Saudi Arabia enforces some of the world's strictest laws on speech deemed offensive to Islam. Such cases may be prosecuted under the kingdom's cybercrime statutes or under broad interpretations of Islamic law, and its courts have handed down prison terms and heavy fines for online expression in the past.
In the video, Mr. Rajeevkanth accused some Sri Lankan Muslims of amplifying the controversy, arguing that any offense should have been investigated and prosecuted under Sri Lankan law rather than escalated into criminal proceedings in Saudi Arabia.
The reported sentence has unsettled Sri Lankan migrant workers and rights advocates. Many in Sri Lanka's Muslim community have appealed for clemency, citing Islam's emphasis on mercy and forgiveness, with some arguing that the Prophet Muhammad himself, were he alive today, would have pardoned Anojan. "His comment was really bad, but we don't have to be so bad as to jail him," one Muslim commenter wrote on social media.
A smaller number of voices, however, demanded severe punishment under their interpretation of Islamic law.
Hundreds of thousands of Sri Lankans work in Saudi Arabia and other Gulf states, and the money they send home is a pillar of the national economy — a dependence that, rights groups have long warned, can leave workers exposed to legal systems far removed from those of home.