It is well-known that the Shaytaan was present at the battle of Badr, and this battle took place in Ramadan, so why was the Shaytaan not chained up at that time?
It is well-known in the books of tafseer and seerah that the Shaytaan was present at the battle of Badr and that he appeared in the form of Suraaqah ibn Maalik. That is mentioned in the commentary on the verse in which Allah, may He be exalted, says (interpretation of the meaning):
“And (remember) when Shaitan (Satan) made their (evil) deeds seem fair to them and said, ‘No one of mankind can overcome you this day (of the battle of Badr) and verily, I will be your protector.’ But when the two forces came in sight of each other, he ran away and said ‘Verily, I have nothing to do with you. Verily! I see what you see not. Verily! I fear Allah for Allah is Severe in punishment.’”
But that is not proven by any saheeh isnaad going back to the Prophet (blessings and peace of Allah be upon him). Rather it was narrated from Ibn ‘Abbaas (may Allah be pleased with him), and there are some reservations about its isnaad, because it is one of the reports narrated by ‘Ali ibn Abi Talhah from him.
It was narrated that Ibn ‘Abbaas (may Allah be pleased with him) said: Iblees came on the day of Badr bringing a troop of devils with him. I saw him in the form of a man from Banu Mudlij, in the form of Suraaqah ibn Maalik ibn Ju‘sham. The Shaytaan said to the mushrikeen: No one of mankind can overcome you this day (of the battle of Badr) and verily, I will be your protector. Then when the people had drawn themselves up in battle array, the Messenger of Allah (blessings and peace of Allah be upon him) picked up a handful of dust and threw it in the faces of the mushrikeen, and they turned and fled. Jibreel came to Iblees and when he saw him, his hand was in the hand of one of the mushrik men. Iblees pulled his hand away, and turned and fled, he and his party. The man said: O Suraaqah, did you not say that you would protect us? He said: ‘Verily! I see what you see not. Verily! I fear Allah for Allah is Severe in punishment.’ That was when he saw the angels.
It was narrated by at-Tabaraani in his Tafseer (13/7).
At-Tabaraani narrated in al-Mu‘jam al-Kabeer (5/47) from Rifaa‘ah ibn Raafi‘ al-Ansaari a report similar to that of Ibn ‘Abbaas, but its isnaad is da‘eef. It includes ‘Abd al-‘Azeez ibn ‘Imraan, who is da‘eef; he was classed as da‘eef by al-Haythami, who gave reasons for that, in Majma‘ az-Zawaa’id (6/82).
Perhaps something that will strengthen the meaning of these two reports is a mursal hadeeth that was narrated by Maalik in al-Muwatta’ (944) from Talhah ibn ‘Ubaydullah ibn Kareez, according to which the Messenger of Allah (blessings and peace of Allah be upon him) said: Iblees is never seen on any day smaller, more humiliated, more defeated and more angry than on the day of ‘Arafah, because of what he sees of the descent of mercy and forgiveness for sins, except what he saw on the day of Badr.” They said: O Messenger of Allah, what did he see on the day of Badr? He said: “He saw Jibreel organising the angels.”
What is meant by “organizing the angels” is that he was putting them into rows for battle.
Because this story has several chains of transmission, it may be sound and acceptable.
With regard to the confusion mentioned by the questioner, it may be answered from several angles, including the following:
1. That the one who took the form of Suraaqah was one of the shayaateen (devils); as for the devils that are chained up, they are the maarid (rebellious) devils .
An-Nasaa’i (2108) narrated that ‘Utbah ibn Farqad (may Allah be pleased with him) said: The Prophet (blessings and peace of Allah be upon him) said: “In Ramadan, the gates of heaven are opened and the gates of Hell are closed, and every shaytaan mareed is chained up.”
It was classed as saheeh by al-Albaani in Saheeh an-Nasaa’i
Ibn Khuzaymah narrated in his Saheeh (3/188) that Abu Hurayrah (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “On the first night of Ramadan, the devils, the maarid (rebellious) jinn, are chained up.” Imam Ibn Khuzaymah included this hadeeth in a chapter entitled: Chapter which explains that what the Prophet (blessings and peace of Allah be upon him) meant when he said that “the devils are chained up” is the maarid (rebellious) jinn among them, not all the devils, because the word shayaateen (devils) only applies to some of the jinn.
2. It is not possible to be certain that what the Prophet (blessings and peace of Allah be upon him) said about the chaining up of the devils was said when fasting was first prescribed. The fast of Ramadan was prescribed in the first year after the Hijrah, and the battle of Badr occurred in the second year; that may have been said after the battle of Badr.
3. The chaining up of the devils only has to do with the believers who are fasting, not the disbelievers.
Abu al-‘Abbaas al-Qurtubi (may Allah have mercy on him) said:
They are only chained up and kept away from those whose fast fulfils the necessary conditions and who pay attention to its etiquette.
Sharh az-Zarqaani ‘ala Muwatta’ al-Imam Maalik (3/137).
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
Those among the devils who are chained up may still cause harm, but it is less and weaker than what happens at times other than Ramadan. It is in accordance with the perfection or otherwise of the fast. If a person’s fast is perfect and complete, the Shaytaan will be warded off in a manner in which he is not warded off from one whose fast is lacking.
Majmoo‘ al-Fataawa (25/246).
From this it is clear that there is no confusion about the shaytaan coming to the mushrikeen just before the fighting started in the battle of Badr.
And Allah knows best.