A person is not held accountable for what he does while he or she has not yet reached the age of puberty. A person is not punished for anything he/she does during this period. The Prophet (peace and blessings be upon him) has stated this: “The pen has been raised for three persons (meaning they are not held accountable for what they do): one who is sleeping until he gets up, a child until he reaches the age of puberty, and an insane person until he becomes sane.”
As to the authenticity of this hadith, it is recorded by Ahmad, Abu Dawud, At-Tirmidhi, An-Nasa’i, Ibn Majah, and Al-Hakim, who classes it as sahih (authentic) according to the conditions stipulated by al-Bukhari and Muslim. At-Tirmidhi classifies it as hasan (i.e. of a good chain of transmitters).
It is out of Allah’s absolute Justice that children are not held accountable for the deeds they do before the age of puberty. Not only this, but out of Allah’s infinite mercy and favor they will be rewarded for any good deed they do as well as those who guide and encourage them to do so.
Ibn Rushd said: “The bad deeds of young children are not recorded but their good deeds will be recorded, according to the sound opinion.”
The author of Mawahib al-Jalil said: “The scholars do not differ concerning the fact that children will be rewarded for whatever acts of obedience (to Allah) they do, and will be let off for any bad deeds that they do, and any bad deeds they do deliberately will be counted as mistakes.”
According to al-Ikmal, many of the scholars said: “Children will be rewarded for their acts of obedience (to Allah), and their good deeds will be recorded, but not their bad deeds.”