It is plain and manifest that the laws about uncleanness and cleanness are decrees laid down by Scripture and not matters about which human understanding is capable of forming a judgement; for behold, they are included among the divine statutes. So, too, immersion as a means of freeing oneself from uncleanness is included among those divine statutes. Now ‘uncleanness’ is not mud or filth which water can remove, but is a matter of scriptural decree and dependent on the intention of the heart. Therefore the sages have said, if a man immerses himself, but without special intention, it is as though he has not immersed himself at all.
Nevertheless we may find some indication (for the moral basis) of this: just as one who sets his heart on becoming clean becomes clean as soon as he has immersed himself, although nothing new has befallen his body, so, too, one who sets his heart on cleansing himself from the uncleanness that besets men’s souls-namely, wrongful thoughts and false convictions- becomes clean as soon as he consents in his heart to shun those counsels and brings his soul into the waters of pure reason. Behold, Scripture says, ‘And I will sprinkle clean water upon you and you shall clean; from all your uncleanness and from all your idols will I cleanse you’ (Ezek. 36:25).
May God, in His great mercy, cleanse us from every sin, iniquity, and guilt. Amen.
(Maimonides, Mishneh Torah, Book 10.)