The Quran and Sunnah affirm divine decree, His determining all matters before He creates them, and their being recorded in a Book. This is a fundamental principle that affirms His knowledge and will concerning everything that will come to pass. It also resolves many difficulties that have led various groups astray in this area concerning questions of knowledge and will.
Belief in divine decree is therefore one of the foundations of faith, as the Prophet, peace and blessings be upon him, stated in the hadith of Gabriel:
“Faith is to believe in Allah, His angels, His Books, His messengers, and resurrection after death, and to believe in divine decree, both its good and its evil.”
Ibn Umar and other Companions disavowed those who denied divine decree. Nevertheless, a group of speculative theologians and others affirm nothing in divine decree beyond eternal knowledge and an eternal will. When they affirm its being written down, they say that this records only part of that.
As for those who say that He determined these matters at that time—as related in Sahīh Muslim from Abd Allāh ibn Amr, from the Prophet, peace and blessings be upon him, who said:
“Allah determined the decrees of all creation fifty thousand years before He created the heavens and the earth, and His Throne was upon the water”—
this has been discussed at length elsewhere.