The Lord said unto Moses, Take all the heads of the people, and hang them up - Israelite criminals, who were capitally punished, were first stoned or slain, and then gibbeted. The persons ordered here for execution were the principal delinquents in the Baal-peor outrage - the subordinate officers, rulers of tens or hundreds.
before the Lord - for vindicating the honor of the true God.
against the sun - that is, as a mark of public ignominy; but they were to be removed towards sunset (Deu 21:23).