Praise be to Allah.
It should be noted that some of our circumstances are forced on us, and and we have no choice in it, such as the day when a person is born, the colour of his skin and eyes, and when he will die. All of these are matters over which people have no control, rather they happen to them by force. Given that these are matters in which people have no choice, they do not have anything to do with Paradise or Hell, torment or blessing.
But some actions are the subject of choice, such as whether to believe or disbelieve, or worldly matters such as choosing what to eat or drink, and where to live.
There is nothing of that nature which is entirely outside the will and decree of Allaah.
But how does that happen?
Belief in al-qadar (the divine will and decree) is one of the pillars of faith. The Muslim’s faith cannot be valid unless he accepts that everything comes from Allaah. Allaah says (interpretation of the meaning):
“Verily, We have created all things with Qadar (Divine Preordainments of all things before their creation as written in the Book of Decrees Al-Lawh Al-Mahfooz)”
Indeed, the names of Allaah include al-Qaadir, al-Qadeer and al-Muqtadir (which refer to His being All-Powerful).
The heart of the matter is that Allaah possesses the attributes of knowledge, power and will.
Based on that, if people who do deeds want to do them, whether they are sins or acts of obedience, then Allaah inevitably knows that, indeed He knew that in eternity past, before He even created the universe.
Then after He knew it, He wrote it with Him, then when they wanted to do it, He willed that they should do so. If He did not will that, then they would not do it. He is All-Powerful, and He is the Creator of people’s deeds because He is the Creator of the human beings who do them.
So all the deeds of mankind are written with Allaah, because Allaah has prior knowledge of them. This does not mean that Allaah compels people to do what they do, rather they have freedom of choice with regard to their deeds. Allaah says (interpretation of the meaning):
“Verily, We showed him the way, whether he be grateful or ungrateful”
But their actions are not compelled by Allaah, for Allaah does not force His slaves to do anything.
Imaam Ibn Abi’l-‘Izz al-Hanafi said concerning a similar matter:
If it is said, How can Allaah will something that He is not pleased with and does not like? How can He will it and create it? How can His will be reconciled with His hatred for it?
It should be said (in response) that this is the question which has caused divisions among the people and has caused them to follow different paths and opinions.
It should be noted that what is willed may be of two types: that which is willed or wanted for itself, and that which is willed or wanted for something else.
That which is willed or wanted for itself is that which is wanted and loved for what it is and for the goodness it contains. So it comes under the heading of aims and goals. That which is willed or wanted for something else may not be what is wanted, but it serves a purpose; it may not serve any purpose in and of itself, even though it may be a means to attain that which he wants and is aiming for. So it may be something that is disliked in and of itself, but he may seek it because it serves a purpose and helps him reach what he wants. So in this case he will have two opposing feelings, his dislike (of the means) and his desire (for the end). There is no contradiction, as these feelings are related to different things. This is like unpleasant medicine which the one who takes it knows will cure him, or like cutting off a wasted limb when he knows that will save the rest of his body, or travelling a difficult route when he knows that it will bring him to what he wants and loves. The wise man would rather accept the disliked thing on the basis that he is likely to get good results even though the ultimate end may not be quite certain. So how about Allaah, from Whom nothing is hidden? He may dislike something but it may not be against His will for it to exist, because it may be a means to an end, and it may be a means to something that Allaah likes. For example, Allaah created Iblees, who is the cause of the corruption of religions, deeds, beliefs and human wills; but nevertheless he is a means to a lot of things that Allaah likes, which result from the creation of Iblees. For these things to exist is dearer to Allaah than if they did not exist at all.
Sharh al-‘Aqeedah al-Tahhaawiyyah, 252-253.