Redemption of the Firstborn Donkey
A firstborn donkey must be redeemed by a sheep, which is given to the Kohen. If this redemption is not performed, we must break the foal's neck (SA YD 321).
While the firstborn of a kosher animal is sanctified, and the firstborn of most non-kosher animals have no sanctity whatsoever; the donkey has an intermediate status. It is not sanctified, but it must be redeemed. "And the firstborn of an ass shall you redeem with a sheep, and if you don't redeem it then break its neck; and all firstborn people of your sons, redeem (Shemot 13).
We explained previously that kosher animals symbolize that aspect of our material nature which can be elevated to Divine service, whereas the non-kosher ones symbolize our lowest drives which need to be shunned and not cultivated.
The commandment to redeem the firstborn of a donkey hints that even among the impure and wicked, who seem to be ruled by their basest instincts and have no external signs of righteousness there are those who are pure at heart and can be redeemed. The donkey has neither cloven hooves nor chews its cud and hence has no signs of purity. In this case even the firstborn itself is not inherently holy but merely has a potential to be redeemed in the service of holiness; the firstborn donkey may be redeemed with a sheep but need not be.
However, truly wicked drives can't be in themselves good. They can be redeemed, that is transformed, into holiness, as symbolized by the redemption on the sheep; if this redemption is not performed, then they need to be utterly stamped out, symbolized by the breaking of the neck.
The ARI Z"L (Rav Yitzchak Luria) points out that at the beginning of the passage, we cited, the Torah refers specifically to the firstborn of Israel. In the continuation of the passage, where the redemption of the donkey is mentioned, this qualifier is absent. He explains that originally the sanctification did not apply to the "erev rav", the mixed multitude of non-Jews who left Egypt together with the children of Israel. However, eventually HaShem acceded to Moshe's wish to have them included as well. The mitzva of redeeming the firstborn of the donkey hints at this expansion, providing a way for even the "mixed multitude" to be redeemed, with, however, the caveat that their holiness is not inherent and, if the redemption does not take place, they will have no place in holiness at all. (Cited in Yedid Nefesh on Zohar Bo, II:41b. See also Igrot Rayah 555.)
So this mitzva carries an immense promise but at the same time a grave warning to the wicked. Even if they seem to have no signs of goodness whatever, if they are good inside they can be redeemed; however, if this redemption does not take place then they are solely an obstacle to goodness.