Among the things which bring about these matters is that the one who loves something is attracted, and the things which is loved, attracts. So whoever loves something is drawn to it in proportion to its strength. And for the one who loves an image, this image draws him in towards what is available of the loved thing exterior to him in proportion to its strength. For indeed the cause of the lover is action-based, and the cause of the beloved is purpose-based, and each of them has an influence on the occurrence of the effect. The lover is only attracted to the beloved through the image he has of the beloved in his heart which he has imagined. So this image attracts him in the sense that it draws him towards it, not that it, in itself, is an end or act. For indeed in the beloved, in conformity with its connotation, in what demands the attraction of the lover to it, just as a person is attracted to food in order to eat it, to a woman in order to make love to her, and to his friend in order to keep his company. This is just like the hearts of those who love Allah and His Messenger are attracted to Allah, His Messenger and the righteous among His slaves due to the Attributes He, glorified is He, possesses and because of which, He deserves to be loved and worshipped.
Rather, it is not permitted to love anything among the existing things for the sake of itself except Him, glorified is He, and through His praise. Thus every beloved thing in the world is only permitted to be loved for the sake of something other than it- not for the sake of itself. And the Lord, exalted is He, is He who loves to be loved for His own sake. This is among the meaning of His Oneness in Divinity: “If there had been in them gods except Allah, truly they would both be corrupted.” (al-Anbiya 21:22) Loving something for its own sake is polytheism, thus nothing should be loved for its own sake, except Allah. Since this is among the things which are specific to His Oneness in Divinity, then no one deserves that except Allah alone. And every beloved thing except Him, if it is not loved for His sake or for what is loved for His sake, then its love is a matter of corruption.
Allah, exalted is He, created in the selves love for nutrients and women due to what they entail of preserving the body the body and the perpetuation of the individual. For indeed if there were no love of nutrients, what people ate would corrupt their bodies, and if there were no love of women, they would not marry and having children would come to an end. The purpose of the existence of all that is to perpetuate each of them in order to worship Allah alone and for Him to be the one who is loved and worshipped for His own sake, he who is alone in deserving that.
The Prophets and righteous only love in accordance with His love. So to have complete love is to love what He loves, and it is to love the Prophets and righteous and righteous deeds. Thus loving them for the sake of Allah is from the completeness of loving Him. As for the love which one has along with Him, then it is the love of the polytheists who love their partners as they love Allah. When the creation loves something for the sake of Allah, its love pulls towards love of Allah. And when two men love each other for the sake of Allah, they unite and separate over that. Each of them pulled the other towards love for Allah, exalted is He, said in a narration: “Those who love each other for My sake, truly love Me. Those who sit together for My sake, truly love Me. Those who give generously for My sake, truly love Me. Those who give generously for My sake, truly love Me. Allah has servants who are not Prophets or martyrs, then the Prophets and martyrs will envy them for their nearness to Allah. They are the people who love each other through the mercy of Allah, without the exchange of any wealth between them or sharing any ties of kinship. Their faces will have a light and they will be on thrones of light. They will not fear when everyone else is afraid nor will they grieve when they grieve.” (See Abu Dawud with a different wording)
Thus, when you love an individual for the sake of Allah, it is Allah who is beloved for His own sake. So whenever you think of him in your heart, you are thinking of the truly Beloved, thus your loving Him increases your love for the sake of Allah. Just like when you mention the Prophet, may Allah’s peace and blessings be upon him, the Prophets before him, the Messengers, and their righteous companions, and you imagine them in your heart, so that draws your heart towards love for Allah, the one who bestows blessings upon them and through them. When you love them for the sake of Allah, then the beloved for the sake of Allah attracts towards love for Allah, and the lover for the sake of Allah, when he loves an individual for the sake of Allah, then indeed Allah is his beloved. Thus He loves that it attracts him towards Allah and who are loved for the sake of Allah, attracts towards Allah.
Likewise when love is for the sake of something other than Allah, for instance, when each of two individuals love the other for their appearance: like a woman with a man, then indeed the lover seeks out the beloved and the beloved seeks out the lover through attraction of the beloved. When both love each other, each of them becomes attracted and attracting from both angles. So it necessitates the connection. Even if the love was from one of the two sides, truly the lover would attract the beloved and the beloved attracts him, however the beloved does not intend to attract him and the lover intends to attract the other and draw them in.
This is ‘the way of influence regarding the beloved‘, whether an image takes shape in his heart, then it draws him in, or he is drawn in without love, like when a man eats food, wears certain clothes, lives in a home, and similar things things related to beloved matters for which there is no desire for them.
As for animals, then some love others because they are a means for good towards them. The souls have been moulded to love whoever is good towards them however this is only a love for the good done to them in reality, not the love for the self of whoever did some good towards it. And if that [good] was cut off due to that love dwindling, and perhaps it results in anger, then indeed it was not for the sake of Allah, lofty and sublime is He.
Truly whoever loves a person because of something he gave him, then he does not love but what was given. And he who says that he loves the one who gave him something for the sake of Allah is lying; it is inconceivable and false in saying. Likewise is whoever loves a person because of his helping him – he only loves the help and not the helper. And all of this is from following what the selves desire, for in reality he does not love anything but what leads to obtaining a benefit or repelling a harm. Thus he only loves that benefit or the elimination of the harm. And he only loves that because it is a means to that which he loves and this is not love for the sake of Allah and not for the sake of the beloved itself.
In general, the love of the creation with one another takes this course, and they will not be rewarded for this in the Afterlife nor will it benefit them, rather maybe that will lead to hypocrisy and flattery. For in the Afterlife, they could be among the friends who are enemies to one another except for those who feared Allah. Only love in Allah and for the sake of Allah alone will benefit them in the Afterlife. As for the one who hopes for some benefit or help from a person, then alleges that he loves him for the sake of Allah, then this is from the schemes of the souls and hypocrisy of words.
Only loving for the sake of Allah what Allah loves among His creation, like the Prophets and righteous will benefit the salve. This is because loving them draws one nearer to Allah and love for Him and them, they are those who deserve the love of Allah.
Our Prophet, peace and blessings of Allah be upon him, gave in order to reconcile the hearts of some, and others claim they are more beloved to him than whoever he gave something to. He measured them according to what was in their hearts of faith and he only gave to reconcile their hearts due to what was in their hearts of anxiety and worry. He did it so that what he gave them could be a means to draw their hearts towards loving Islam, and then they could love Allah. So his intention in that was to invite the hearts towards loving Allah would flip them around on their faces in the Hell-Fire. This through that gift he withheld them from what He disliked from them, thus he would give for the sake of Allah and withhold for the sake of Allah. The Prophet, peace and blessings of Allah be upon him, said: “Whoever loves, gets angry, gives, and withholds for the sake of Allah, then he has complete faith.” (Abu Dawud)
And also in Bukhari, on authority of the Prophet, peace and blessings of Allah be upon him: “Indeed I, by Allah, am only a distributor – I do not give to anyone or withhold from anyone, rather I put things wherever I am commanded.” (Bukhari)
Gardens of Purification by Ibn Taymiyyah Pages 89-93