Brazil has offered asylum to Sakineh Ashtiani, an Iranian woman who was convicted of adultery in 2006 and sentenced to death by stoning. A few weeks ago, the sentence was “temporarily halted” by Iranian officials, but Ashtiani still faces the death penalty. When stonings happen, how do they work?

First, you get buried. Iran’s Islamic Penal Code states that men convicted of adultery are to be buried in the ground up to their waists; women, up to their chests. If the conviction is based on the prisoner’s confession, the law says, the presiding judge casts the first stone. If the conviction is based on witness testimony, the witnesses throw the first stones, then the judge, then everyone else—generally other court officials and security forces. Stones must be of medium size, according to the penal code: Not so big that one or two could kill the person, but not so small that you would call it a pebble. In other words, about the size of a tangerine. The whole process takes less than an hour.

One possible upside of getting stoned is that people who manage to escape from the hole are allowed to go free. But this applies only to those who have confessed to their crimes. (If you were sentenced to stoning on the basis of witness testimony, then digging out of the hole does you no good.) In any case, it’s very difficult for anyone to escape the punishment: Prisoners are wrapped in a white cloth sack with their hands tied.

Stonings in Iran used to be public. Between 1983 and about 2000, anyone could attend and throw rocks. After that, public outcry against the practice grew, and stonings began to be carried out in private, often at a cemetery. In 2002, the head of Iran’s judiciary issued a moratorium on stoning sentences, but that was more of a guideline rather than a change to the law, so the practice continued even as top officials denied it. In the summer of 2009, a parliamentary commission recommended removing the stoning law from the books, but parliament has yet to revoke it formally. (You can see disturbing NSFW footage of a 1994 public stoning here.)

Iranian law spells out three ways an alleged adulterer can be sentenced to stoning: The defendant confesses, witnesses testify to the defendant’s guilt, or the judge convicts the defendant based on his own “knowledge.” (This last one is just as arbitrary as it sounds.) When it comes to witnesses, one isn’t enough: A court needs four men to testify, or three men and two women. If two men and four women testify, the alleged adulterer can only be sentenced to flogging.

Got a question about today’s news? Ask the Explainer.

Explainer thanks Hadi Ghaemi of the International Campaign for Human Rights in Iran.

Like Slate and the Explainer on Facebook. Follow us on Twitter.