It probably reminds the leaders about their fate after they die.
The ritual itself probably goes back to the religion that existed in Persia BEFORE Islam so rudely proceeded to extinguish it.
Zoroastrianism was the religion of the Magi who followed to star to Bethlehem at the time of the birth of Christ, and they had kept predictions and records dating back to before the Babylonian captivity of the Jewish people. The interaction of the monotheistic Zoroastrian religion and the Jewish Talmud created a new synthesis which affected both religions. The concepts of Hell, Paradise, the Devil (Ahriman), and angels (cherubim and seraphim) were of Zoroastrian origin, and were incorporated into the later Christian religion.
Oddly enough, much of that never found its way into the learned study of Islam, except some form of Paradise, and that for all the wrong reasons.