What is intended by the ayah is to warn them from following those who follow their desires. In other words, it means, ‘I wish for you good which will benefit you and they wish evil for you which will harm you, like Shaytan who wishes to lead you astray and the people of desire follow him; so do not take him and his children as friends and protectors besides Me, rather adhere to the paths of the guidance and right guidance, and beware of the paths of straying and corruption’.
As He, exalted is He, said, “So whoever follows guidance, the he will not be misguided or be unhappy.” (Taha 20:123) And His statement: “…follow desires.” (al-Nisa 4:27) is in two places. To follow desires is a type of following whims, as He, exalted is He, said: “They only follow their whims, and who is more misguided that he who follows his whims without guidance from Allah.” (al-Qasas 28:50) And He, exalted is He, said, “And if the truth was according to their whims, truly the Heavens, the Earth and all that is in them would be corrupted.” (al-Muminun 23:71) Allah also said: “And do not follow the whims of a people that strayed before you.” (al-Maidah 5:77) He, exalted is He, said: “Is he who is upon a proof from his Lord like those whose evil deeds are made to appear good to them and they follow their whims?” (Muhammad 47:14) And Allah said: “And do not follow the whims of those who do not have knowledge.” (al-Jathiyyah 45:18) This is mentioned in the Qur’an a great deal.
‘Whim‘ (hawa) is a verbal noun from the verb ‘to fancy‘. The present tense form of the verb is ‘yahwi‘ and the past tense form is ‘hawa‘ as well. For a person who is desirous, whatever he fancies is called ‘hawa‘, thus he follows it like he follows a path.
As Allah, exalted is He, said: “And do not follow the whims of a people who have strayed before you.” (al-Maidah 5:7) and as in the term ‘shaybah‘, then what is intended by following whims is a term itself based on the verbal noun, in other words, following his desires and fancies which are his whims. Following desires is acting upon whatever the ‘self‘ desires. It is as Allah, exalted is He, said: “And follow the paths of he who turns in repentance to Me.” (Luqman 31:15) and “And this, My path, is straight, so follow it and do not follow the [other] paths for they will separate you from His path.” (al-Anam 6:153) and further, He said: “And do not follow protectors or friends beside Him.” (al-Araf 7:3)
So the term ‘follow‘ means to follow the authoritative prohibition, the command and the prohibition, and it is directed at the one commanded and the one prohibited. It is the Straight Path.
Likewise for whims there is a command and a prohibition – a command of the self and a prohibition. Just as Allah, exalted is He, said: “Indeed the self constantly urges evil except for when my Lord grants mercy. Indeed my Lord is forgiving, merciful.” (Yusuf 12:53) However what [the self] commands of objectionable acts, then one of them requires another. Thus the following of a command in an act of one who is commanded and following a command of the self is an act of what [the self] desires. So based on this, it is known that the following of desires and the following of whims is following the desire of the self and its whims and that is by acting upon what it desires and fancies.
Rather it has been said: this is what is specified in there wording ‘following desires and whims‘ since that which one desires and fancies only comes into being after desiring and fancying and a person is disparaged only when he does what he desires and fancies upon its coming into being. So at the time he acts [upon his desires and whims], he is not prohibited from it after its coming into being, and it is not said to its companion ‘do not follow your whims‘.
Also, the act that is desirable and wished for which a person fancies is to follow his desires and whims, thus desires and whims do not follow him. So to follow desires is to follow the desires of the self. And when [the self] produces a desire, in the sense of something that it finds desirables, in spite of contradicting the source [to be internal], it calls for producing externally what is desired and the person follows it, like a desired woman or food. And if the woman is designated as a desire and food as well, like what the Prophet, peace and blessings of Allah be upon him, said:
“Every act of the son of Adam is for him except fasting. For indeed it is for Me and I will reward him for leaving his food, drink and desire for My sake” (Bukhari)
in other words, he abandons his desire. He only neglects what he desires like he neglects food, not that he leaves his food through abandoning the desire existing in his self. For indeed that is a characteristic in him that he is naturally disposed to and he is only rewarded if he abandons what that desire demands of him.
‘The reality of the matter‘ consists of two inseparable things – whoever follows a desire existing in himself, he follows what he desires; and similarly whoever follows a whim existing in himself, he follows what he fancies. That is among the effects of desire and following desires – obediences to its command and acting upon what it demands of him like a follower of orders who follows the command of his commander. It is inevitable that he will imagine the objective that he fancies and desires in his self and he will envision it before acting upon it. That image persists, like the Imam with the one following him in prayer – he follows him wherever he is, and his external actions follow the lead of what is internal. Thus the image of what is desired and sought after, which is in the self, is the motivation and commander of the individual.
Due to this, it is said: the final cause is the effective cause, so the person, due to the final cause – through this imagining and wishing – becomes a doer because of the act and this image in the self that is fancied and sought after makes the doer act. Thus the person is a follower of it and Shaytan helps him in straying, and [Shaytan] strengthens this image and its effects and makes following it seem attractive to the person. The image reaches the form of the very thing wished for such as what is desirable among images, food and drink. It reaches for the essence of the act which is the pursuit of that wished for desirable thing, and which Shaytan and the self fancy, and whenever he imagines that desirable thing in his self, he wishes for it to exist externally. Then indeed the first thought is the last acted upon and the first wished for is that last obtained.
Because of this, a person remains a prisoner to his desires and whims; because of that he is subdued under the authority of a whim greater than any conqueror. For indeed this capricious conqueror, the conqueror of the slave is a characteristic existing in his self. And the mental image that the self seeks after is impossible for him to definitively separate from. So the beloved thing the self seeks to obtain and represent in his self, is a follower of the wish, even if the mental image of adornment of the matter are from the beauty and desired fantasy in his self. What is desired existing externally holds two motivations for him – the fantasy and the desired thing. This provokes in him a movement of seeking and commands, and it commands him to follow its demands and commands. Thus following the desires and whims deals with all of this in contrast to every conquerer a person can break away from. For indeed it is possible for him to break away from him while his self remains upon the same state, and in that case [of desires and whims] he can only break away from it by altering the condition of his self.
Thus the Prophet, may Allah’s peace and blessings be upon him, said:
“There are three things which lead to destruction: stinginess obeyed, a whim followed, and the admiration of a man for himself. And three things lead to salvation: Fearing Allah in private and in public, moderation in poverty and richness, and a word truth while angry or pleased.” (Shu’ab al-Iman 731)
In the narration, his statement ‘a whim followed‘ is proof that what is followed is something that lies in the self, like what is said about the statement ‘stinginess obeyed‘. He made stinginess something obeyed because it commands while he made the whim something to be followed. That is because something followed is a leader to be imitated and it is not a commander.
In both Bukhari and Muslim it is related that the Prophet, peace and blessings of Allah be upon him, said:
“Beware of stinginess for indeed it destroyed those before you. It commanded them to be miserly, so they were miserly. It commanded them to be oppressive, so they oppressed. And it commanded them to cut ties of kinship, so they cut ties of kinship.” (Abu Dawud 1698 with a slightly different wording)
Thus he clarified that stinginess commands miserliness, oppression, and the severing of ties. Miserliness is an obstacle to that which benefits people through their selves and wealth while oppression is an aggression against them.
The first is negligence in what is obligated, so he will be negligent in what he is obligated to do and aggressive against them in acting upon what is prohibited. And he singled out the severing of ties by mentioning it out of respect for it since it is involved in the two matters that came before it.
Gardens of Purification by Ibn Taymiyyah Pages 61-68