Leviticus 24:23

And Moses spake to the children of Israel, that they should bring forth him that had cursed out of the camp, and stone him with stones. And the children of Israel did as the LORD commanded Moses.

By God's direction the man who had cursed was brought forth outside the camp and stoned with stones, and the children of Israel did as the Lord had commanded Moses. The witnesses laid their hands upon the offender's head to solemnly attest the truth of the charge against him, and then they cast the first stones. The people standing by joined in carrying out the sentence.

The sentence came because, after a judgment had gone against him, he cursed the name of God in his rage. His execution was set as a warning that the name of God must be held in reverence and never spoken in contempt or anger. Had his offense been allowed to pass unpunished, others would have been emboldened to dishonor God, and evil of far greater magnitude would have followed.