A mosque buried its imam in the backyard — and a little Rockland County village almost died of shock.

Tosun Bayrak al-Jerrahi al-Halveti, who founded the Jerrahi Order of America mosque in Chestnut Ridge, died at the age of 92 in February 2018.

He was laid to rest behind the house of worship a few days later. And in May of this year, the faithful erected a grand monument made from imported Turkish marble. A bench was installed next to it.

Etched into the marble tomb is one of the sheikh’s favorite sayings: “The most beloved of Allah’s servants are those who engender Allah’s love in his servants and their love in Allah.”

The gravesite is the picture of tranquility. But it has not been a peaceful resting place.

The issue of private burials has haunted the public discourse in this village of 8,000 souls ever since, with opponents — led by a retired FBI agent — saying backyard graves are public health risks and that village officials should never have OK’d one.

“I don’t think that an incorporated village where people live next door to one another on small or large parcels of land should allow the burial of human remains on properties,” said Hilda Kogut, the ex-Fed and chairwoman of Citizens United to Protect Our Neighborhoods, who called the town policy a “shock to the system.”

Embarrassed village officials soon claimed they tried to stop the burial, but didn’t have the legal authority to block it. The mosque, providing correspondence as proof, said it asked for permission from the village to bury their beloved imam, and received it.

The mosque “did it against our respectful wishes,” Chestnut Ridge Mayor Rosario Presti insisted.

The mosque’s current sheikh, Yurdaer Doganata, noted that the congregation followed “local safety codes and health regulations and used a traditional casket. It was a green burial and there were no chemicals used. The grave site was approximately six feet deep. A member of our community who is a licensed contractor performed the ground preparations.” The coffin was made from wood with no nails, he said.

The state does not have a law against home burial and allows local governments to pass their own ordinances regarding the practice. Chestnut Ridge has no law on the issue.

Such interments are safe, and not uncommon in others parts of the country, according to the Funeral Consumers Alliance.

“The myth of contagion from dead bodies is one of the most persistent of the American funeral industry,” reads the alliance’s website. “There is no evidence, peer-reviewed or otherwise, to justify it.”

Still, New Yorkers creeped out by the prospect of living among the dead, need not be; NYC forbids private, at-home burials.

Mayor Presti said the village hopes to soon draft an ordinance that bans backyard burials. But the late shiekh’s followers will not have to worry about an exhumation.

“You can’t unring that bell,” the mayor said.