Praise be to Allah.
Al-Bukhaari (6388) and Muslim (1434) narrated that Ibn ‘Abbaas (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “When any one of you wants to have intercourse with his wife, let him say, ‘Bismillaah, jannibnaa al-shaytaan wa jannib al-Shaytaan ma razaqtana (In the name of Allaah. Keep the Shaytaan away from us and from what You bestow upon us).’ Then if it is decreed that they should have a child, the Shaytaan will never be able to harm him.”
This hadith contains a promise to the one who says that and is blessed with a child, that the Shaytaan will not harm him, but that does not necessarily mean that if a person does not recite these words at the time of intercourse that the Shaytaan will inevitably harm his child, or that the Shaytaan will inevitably have a share of that intercourse. The hadith does not say that; rather he has missed out on the virtue and protection mentioned here, but if he did not do that because of an excuse, such as if he was unaware of it, or he forgot it at that time, then he will be pardoned, if Allah wills, because of the promise that Allah, may He be exalted, made to the ummah of the Prophet (blessings and peace of Allah be upon him).
Please see also the answer to question no. 135477.
There are many ways in which the one who missed out on the virtue mentioned here can make up for what he has missed. They include the following:
He can strive hard to obey Allah and obey His Messenger (blessings and peace of Allah be upon him) in word and deed, to fear Allah, may He be glorified and exalted, in secret and in public, and to seek halaal earnings, whilst constantly remembering Allah and reading or reciting Qur’an. All of that will guarantee – by the grace of Allah – that a person himself and his wife and children will be protected.
Al-Haakim (3395) narrated that Ibn ‘Abbaas (may Allah be pleased with him) said, concerning the verse in which Allah says (interpretation of the meaning), “and their father was a righteous man” [al-Kahf 18:82]: They were protected because their father was righteous; there is no mention of whether they were righteous.
Classed by al-Haakim as saheeh according to the conditions of al-Bukhaari and Muslim; adh-Dhahabi agreed with him.
Al-Haafiz Ibn Rajab (may Allah have mercy on him) said:
Sa‘eed ibn al-Musayyab said to his son: I increase my prayer for your sake in the hope that you will be protected for my sake. Then he recited this verse (interpretation of the meaning), “and their father was a righteous man” [al-Kahf 18:82]. ‘Umar ibn ‘Abd al-‘Azeez said: There is no believer who dies but Allah will protect his offspring and the offspring of his offspring for his sake. Ibn al-Munkadir said: Allah will protect, for the sake of a righteous man, his children and his children’s children, and the households around him, and they will continue to be under the protection of Allah.
When a person is preoccupied with obedience to Allah, Allah will protect him in that situation. End quote.
Jaami‘ al-‘Uloom wa’l-Hikam (p. 187)
Ibn Abi Shaybah (35374) narrated that Khaythamah said: ‘Eesa ibn Maryam (peace be upon him) said: Glad tidings to the child of the believer; glad tidings to him, they will be protected after he is gone; and Khaythamah recited the verse (interpretation of the meaning), “and their father was a righteous man” [al-Kahf 18:82].
He also (36460) narrated that Abu Moosa said: al-Hasan recited this verse (interpretation of the meaning), “and their father was a righteous man” [al-Kahf 18:82]. He said: There is no mention of his two children being righteous; Allah protected them for the sake of their father.
Ibn Katheer (may Allah have mercy on him) said: The words (interpretation of the meaning), “and their father was a righteous man” [al-Kahf 18:82] indicate that the progeny of a righteous man will be protected, and the barakah (blessing) of his worship will benefit them in this world and the hereafter, and by virtue of his intercession for them, they will be raised to the highest degrees in Paradise so that he may have the joy of the company, as it says in the Qur’an and is mentioned in the Sunnah. End quote.
Tafseer Ibn Katheer (5/186-187)
Another matter to which attention should be paid in the hope that the child will be righteous is to release him from the pledge by offering the ‘aqeeqah on the seventh day after his birth, because the Prophet (blessings and peace of Allah be upon him) said: “Every child is in pledge for his ‘aqeeqah, which is to be sacrificed on his behalf on the seventh day, his head is to be shaved, and he is to be given his name.”
Narrated by Abu Dawood (2838); classed as saheeh by Shaykh al-Albaani in Saheeh Abi Dawood.
It was said that what is meant is that the ‘aqeeqah is a means of freeing the child from the Shaytaan and protecting him from him.
Please see also the answers to questions no. 12448 and 60252
Ibn al-Qayyim (may Allah have mercy on him) said:
The apparent meaning of the hadith is that he himself is kept in pledge and prevented and detained from some goodness intended for him, but that does not imply that he will be punished for that in the hereafter, even though he may be prevented, because of his parents not doing the ‘aqeeqah, from that which another may get for whom his parents did do the ‘aqeeqah. And the child may miss out on some good because of his parents’ negligence, even though that is not his fault. End quote.
Zaad al-Ma‘aad (2/326)
Supplication (du‘aa’) is another shar‘i means of protecting one’s children, as Allah, may He be glorified and exalted, says concerning His believing slaves (interpretation of the meaning):
“And those who say: ‘Our Lord! Bestow on us wives and offspring who will be the comfort of our eyes, and make us leaders for the Muttaqoon (pious)’”
Ibn Jareer (may Allah have mercy on him) said:
Allah, may He be exalted, says: those who turn to Allah in their du‘aa’ and ask of Him by saying: “Our Lord! Bestow on us wives and offspring who will be the comfort of our eyes” by causing us to see them doing acts of worship and obedience to You. End quote.
Tafseer at-Tabari (19/318)
Then he narrated that al-Hasan and Sulaymaan at-Taymi said concerning the phrase “the comfort of our eyes”: (This refers to) the believer seeing his wife and children obeying Allah.
Ibn al-Qayyim (may Allah have mercy on him) said:
So they ask Him to give them the joy of seeing their spouses and children complying with His commands. End quote.
Ar-Rooh (p. 252)
Ruqya as prescribed in Islam is a means of protecting one’s children. Al-Bukhaari (3271) narrated that Ibn ‘Abbaas (may Allah be pleased with him) said: The Prophet (blessings and peace of Allah be upon him) said: “Your father (Ibraaheem) used to seek refuge with (these words) for Ismaa‘eel and Ishaaq: A‘oodhu bi kalimaat Illaahi’t-taammah min kulli shaytaanin wa haammah wa min kulli ‘aynin laammah (I seek refuge in the perfect words of Allaah from every devil and every vermin, and from every bad eye)”.
It is also worth pointing out with regard to this issue that children should be prevented from going out (after sunset) until it is fully dark, because that is the time at which the devils come out. It was narrated from Jaabir ibn ‘Abdullah (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “When the wings of the night spread – or when evening comes – keep your children in, for the devils come out at that time. Then when part of the night has passed, let them go. And close the doors and mention the name of Allah, for the Shaytaan does not open a closed door. And tie up your waterskins and mention the name of Allah, and cover your vessels and mention the name of Allah, even if you only put something over them, and extinguish your lamps.”
Narrated by al-Bukhaari (5623) and Muslim (2012).
The phrase “when the wings of the night spread” refer to the time after the sun has set, which is the first part of the night.
Imam Ahmad (14482) narrated from Jaabir ibn ‘Abdullah (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: “Keep your children in until after it is fully dark, for that is a time when the devils come out.”
The phrase “until it is fully dark” refers to the first part of the night.
Whatever the case, adopting the measures prescribed in Islam with regard to raising children is the basis for protecting them from the accursed Shaytaan.
And Allah knows best.