The Talmud Tractate Megillah 25a teaches:
Rabbi Chanina said “Everything is in the hands of Heaven except for the fear of Heaven.”
What exactly does Rabbi Chanina mean with his statement?
The Rambam (Maimonides) provides a very good explanation in his Mishna Torah (Hilchot Teshuva, 5:2):
There are fools among the Gentiles who claim that, at the time of man’s creation, G – d decrees whether a human will be righteous or wicked. This is untrue, as each person is fit to be righteous or wicked. Each person has the potential to become the greatest Zaddik (righteous person) or the most evil person.
When a baby is born, G – d decrees the level of intelligence or whether this newborn will be poor or rich. G – d also knows the day when we die. However, He leaves it up to us if we become G – dfearing and righteous or if we turn to the opposite side. This is our choice and we have to take responsibility.