Allah (swt) says in a Hadith Qudsi:
"I was a hidden treasure(a pure essence,absolute existence clear of all existence,image or like ness),I loved to be known, so I created the creation(when all and everyhting became a reflection of My attributes,the symbols of My Essence) so that it might Know me"
The Prophet (saw):
"Allah existed and nothing else existed with Him,and now Allah exists and nothing else exists with Him"
(Before the creation there was nothing but Him.After the creation there is nothing but Him.)
Wtihin His creation,the attributes indicating His perfection are reflected only in man.The qualities of living,knowing,hearing,seeing,will power,talking,and the dependence of all else are His gifts to humanity.But His greatest gift is love,the manifestation of His love of knowing Himself.Love is the primary sustenance for human beings.They cannot live without it,and mankind learned to love from Allah.
Love is given to man so that he may seek and find the Beloved.It is that which creates energy in the creation,an energy produced by the inclination of the Divine will to be known that is reflected upon man.The love of man for Allah and his love for his own kind and for all else that he loves is the name of this energy.All creation,all that has happened and is happening,comes about through love.
Allah created the creation so that the creation would know Him,and love is the means both of creation and of knowing Him,and to know Him is the purpose of love.Whenever love has for a goal anything other than knowing Him,the life-giving energy in it escapes,and love is lost.