First of all, it is to be stated that there is no contradiction between Allah’s predestination and foreknowledge of everything and the freedom He has given us to choose between what is good and what is evil. We are free and we can do whatever we like and we are accountable for this. Thus, man is not allowed to sin and then claim that Allah had predestined him to do so.
In other words, Allah has the knowledge of all things and He has the power over all things. Allah, however, has also granted freedom to human beings. Allah’s power and foreknowledge do not mean that human beings have no freedom, nor does Human freedom negate Allah’s power and foreknowledge. Allah will judge us according to the freedom and responsibility that He gave us.

Sheikh Hamed Al-`Ali, instructor of Islamic Heritage at the Faculty of Education, Kuwait and Imam of Dahiat As-Sabahiyya Mosque, states that: “There is no contradiction between belief in qadar, or Allah’s decree and preordainment and one’s confession to his being disobedient to Allah and that he or she has to repent of his or her sins. This stems from the fact that believing in Allah’s qadar is also to believe in the part that is attributed to Allah and ascribed to Him; on the other hand, confessing to one’s mistake is related to a person and it’s quite a part of actions ascribed to one’s own choice and will.
In his commentary on the book Al-`Aqidah At-Tahawiyyah, Ibn Abi Al-`Izz, may Allah bless his soul, states:
‘Belief in Allah’s Decree and Preordainment consists of two parts: The first part is related to Allah and is attributed to Him, which we are supposed to accept and believe in. The second part is related to the servant and is ascribed to him or her. In the latter part sometimes we accept and be pleased with it; sometimes we are supposed to reject it and show dissatisfaction with it.
To illustrate, killing oneself is viewed through two perspectives: on the one hand, it is Allah’s Preordainment and its occurrence is a reflection of the Divine Decree. On the other hand, it is certainly an act carried out by a mortal, with full and unimpaired menswear. We are supposed to reject the latter part.’
Thus, as Ibn Abi Al-`Izz, may Allah bless his soul states, each sin we commit has two considerations like this: we believe that Allah destined everything even sins, and we are supposed to turn penitent to Allah because we commit them willingly and out of our full sense and consciousness.
Applying this to your case, you have a chance to be a good Muslim through your character and deeds, or you may follow the Shaytan (Satan) and take the wrong way. In both cases, there is Divine Decree but you are the one who chooses which way you wish for yourself. This indicates that the concept of Allah’s Preordainment of man’s affairs does not give a person an excuse to do whatever he likes and then attributes his deeds to the qadar of Allah, as Allah has told us what to do and what to avoid in a crystal clear way. Qadar does not mean that Allah forces you to go to the wrong way or commit sins. Every one has his or her own choice and Allah told us the reward of good deeds and the punishment of bad deeds. Thus, everyone is held accountable for his or her own deeds.”
Elaborating on the question in point, we’d like to add that there are two circles of qadar a Muslim should know about. In his commentary on Al-`Aqidah At-Tahawiyyah, Ibn Abi Al-`Izz states: “There are two circles of knowledge. The first circle relates to the lawful will of human beings. In that arena, man is accountable for everything he does because he has the reason and power to do or not to do. That is why anyone who has not reached puberty, is insane, or is asleep is not held accountable for what he does because he does not have the option and will in what he does. However, when having full control of himself and his mind, it won’t be plausible for someone to say, ‘I drink alcohol because Allah has predestined me to drink’, or ‘I do not pray because Allah has not predestined me to do so.’ Our answer to that person is: ‘You have a free will by which you can decide what you want to do and what you do not.’ That is the first circle of qadar.
The other circle is completely governed by the Will of Allah, and this is of the ghayb (unseen or unknown) dimension. Man does not have any access to that circle. Ghayb is usually the area that Allah knows about, and maybe Allah let some of His servants or Messengers be aware of something of that ghayb. As the Qur’an says in surat Al-Jinn, “He is the knower of the unseen and He reveals unto none His secret save unto every messenger whom He has chosen and then He makes a guard to go before him and a guard behind him.” (Al-Jinn: 26-27)
In that circle, as man has no access to know what is predestined for him, he has no right to talk about it because everything of that circle is fully governed by Allah’s Supreme Will. Man cannot talk of anything of which he is not provided with knowledge. The Prophet, peace and blessings be upon him, taught his Companions to avoid arguments or debates concerning such issues.”
Shedding more light on these two circles, the eminent Muslim scholar, Sheikh Muhammad Al-Hanooti, member of the North American Fiqh Council, adds:
“There are two circles of qadr. One of those circles is called the circle of the lawful will. In that circle, man can decide what to do or what not to do. He has a full free will. There is nothing compulsory for man in that circle. Everything of that circle is his responsibility. He can be praised if he complies with the law. He will be condemned if he violates the law. No one in this circle will justify what he does or what he neglects as a matter of qadr.
The second circle is that of the unseen or ghayb. Allah decides whatever He wills, but no one has an access to that circle. No man can ever allege that he can reach this circle. Man has no authority to interrogate anything of that circle. Allah says, “He is never questioned for what He does, but people are accountable.” (Al-Anbiya’: 23) We know that the first circle is ruled and controlled by the second one, but we are not provided with any access to it. For instance, why did Allah create Iblis? We know certainly that this is of the second circle. Allah has a wisdom that we don’t know. The Qur’an tells us that we could like something whereas it is bad for us or dislike something whereas it is good for us because Allah knows, but we don’t know. We should focus in everything from birth to death on the first circle.”