The song was written by poet
Ahmed Rami and composed by
Riyad al-Sunbati for the 1940 Egyptian musical film
Dananir, directed by
Ahmed Badrakhan and starring Umm Kulthum. According to an anecdote that has been circulated by newspapers, Umm Kulthum first heard a street vendor uttering the words "" () outside
Radio Cairo in 1937. Then, reportedly, poet
Bayram al-Tunisi began writing lyrics starting with these words but did not complete them, and they would subsequently be completed by Rami. According to the Egyptian writer and film critic
Tarek El Shennawi, this origin story is fabricated and especially improbable when it is considered that the two poets were in tense relations. For radio and record release, Rami rewrote the final stanza, replacing references to the Tigris and Abbasid figures with an invocation of the Nile. == Composition ==