The Essentials of Fasting:
There are two essential conditions for the validity of the fast:
Abstention from all acts that break the fast – This is based on the words of Allah:
“Eat and drink until the white thread of dawn becomes distinct to you from the black thread [of night]. Then complete the fast until the night.” ( Sūrah al-Baqarah, 2:187. Adiyy bin Ḥātim reported: “When the words, ‘Until the white thread becomes distinct to you from the black’ were revealed, I took a black rope and a white rope and put them under my pillow. I began looking at them during the night but they were not clear to me. In the morning I went to the Messenger of Allah and mentioned that to him, and he said: ‘It is only the black of night and the white of day.’ ” (Al-Bukhāri and Muslim) Sūrah al-Bayyinah, 98:5.)
Intention (niyyah), for Allah has said in the Qur’ān:
And they were not commanded except to worship Allah, sincere to Him in religion.
Sincere intent to do something only for the acceptance of Allah is an essential condition of worship, the other one being correctness of the act according to the Shari‘ah. The Messenger of Allah said, “Actions are only by intention, ( i.e., actions are valid by intention or judged by intention. ) and for every person is only what he intended.” (Al-Bukhāri and Muslim)
For obligatory fasting, the intention must be made during any part of the night before fajr. ( The niyyah, or intention is achieved by mere knowledge that one will fast the coming day as long as he is able to do so without excessive hardship. ) The Prophet ( ) said: “Whoever does not resolve to fast before fajr has no fast.” (Aḥmad – ṣaḥeeḥ) (The majority of scholars are of the opinion that this applies to obligatory fasting only and not voluntary fasting.)
The intention is not to be pronounced by the tongue, but is an act of the heart and mind. One intends to fast in obedience to Allah, seeking His acceptance and drawing nearer to Him.
Beginning and Ending the Fast:
A person who fasts may eat, drink and have marital relations during the night hours from maghrib (sunset) to fajr (dawn). If one is engaged in any of these things at the onset of fajr he must stop immediately. Should he continue, his fast for that day will not be valid. The Qur’ānic order is explicit: “Eat and drink until the white thread of the dawn becomes distinct from the black thread [of night].”
But as long as one is in doubt about whether or not the time of fajr has come, he may continue to eat and drink until he becomes certain of it.He should not base the beginning of his fast on uncertainty or speculation. And one need not stop eating some time before (A principle of Islam and major axiom of Islamic Law is that legally, things are assumed to remain as they are unless and until it is established with certainty that they are otherwise. Extraneous doubts are of no consequence. )fajr just to be on the safe side. (On some of the prayer timetables is a column called “imsák”. These timetables suggest that people should stop eating ten or fifteen minutes before fajr. However, there is no basis for this in Islamic law. It was not the practice of the Prophet nor of his companions or their students.) Ibn ‘Abbās instructed, “Continue to eat until you are certain about the time.” And Aḥmad bin Ḥanbal said, “If you have some doubt about fajr, eat until you are sure it has come.” Imām an-Nawawi added, “The followers of ash-Shāfi‘i agree that one may eat when he is uncertain whether or not the dawn has come.” However, as soon as he knows that fajr has come one must stop eating and drinking.
As for breaking the fast at maghrib, it is to be done as soon as the sun has set, i.e., when the top of the sun disappears into the horizon. It is not permissible to break the fast when one is not sure whether or not the sun has set. But if the fasting person believes the sun has set and breaks his fast, and then finds that it had not set, there is no sin on him. Evidence for this is the report by Asmā’ bint Abi Bakr. She said, “We broke our fast on a cloudy day during the time of the Prophet , and then the sun appeared.” (Al-Bukhāri)
It is clear from this narration that they did not break their fast on the basis of certain knowledge, because in that case the sun would not have reappeared. Rather, they did so thinking that most likely it had set, then the clouds dispersed and the saw the sun. If their fast had been invalidated because of that and it was necessary to make up that day, the Prophet would have ordered them to do so and his companions would have known it and passed on the information.