Khaqani was born into the family of a carpenter in Shirvan. He was Tat. Khaqani's mother was originally a slave-girl of Nestorian Christian faith who had converted to Islam. According to Khaqani, she was a descendant of "the great Philippus", which some scholars such as Minorsky (1945) have interpreted as meaning Marcus Julius Philippus. Khaqani lost his father at an early age and was brought up by his uncle, Kāfi-al-Din ʿOmar, a physician. Later in life, Khaqani wrote a poem in his praise, in which he used the similarity of his uncle's name and that of Omar Khayyam to compare their virtues.