The Zahiris, however, rejected this and said: “Masturbation does not invalidate the fast, even if it results in ejaculation” (1), because there is no proof in the Quran or the sunnah that it invalidates the fast. The fundamental categories of things that invalidate the fast are three, and this is not among them; therefore, it requires evidence. We cannot declare an act of worship performed by Allah’s servants invalid except on the basis of evidence from Allah and His Messenger, may Allah’s peace and blessings be upon him.
But in my view—and Allah knows best—it may be established that it invalidates the fast in two ways:
The first is the textual evidence. In an authentic hadith, Allah says concerning the fasting person: “He gives up his food, his drink, and his desire for My sake” (2). Masturbation is an act of desire, and ejaculation is desire. The proof that semen may be referred to as “desire” is the statement of the Messenger of Allah, may Allah’s peace and blessings be upon him: “In the sexual act of one of you there is charity.” They said, “O Messenger of Allah, does one of us satisfy his desire and receive a reward for it?” He said: “Do you not see that if he were to place it in what is unlawful, he would bear a sin? Likewise, if he places it in what is lawful, he will have a reward” (3). What is deposited is semen.
The second is analogy. We say: The sunnah establishes that the fast is invalidated when a fasting person deliberately induces vomiting and vomits, and that it is invalidated when one undergoes cupping and blood is drawn from him. Both of these weaken the body.
As for the expulsion of food, it is plainly weakening, for the stomach is left empty, causing a person to become hungry and thirsty quickly.