Muhammad was born in . His birthplace was almost certainly in the
Hejaz (western Arabia), either in
Ta'if, the traditional home of his Thaqif tribe, or in
Mecca or
Medina. Following their general embrace of Islam in , members of the Thaqif gradually attained high military and administrative ranks in the
nascent Caliphate and played important command and economic roles during and after the
early Muslim conquests, particularly in
Iraq. The tribe produced effective commanders associated with early Arab military operations against the
Indian subcontinent: in the Thaqafite governor of
Bahrayn (eastern Arabia),
Uthman ibn Abi al-As, dispatched naval expeditions against the Indian ports of
Debal,
Thane and
Bharuch. The tribe's power continued to increase with the advent of the
Umayyad Caliphate in 661. Muhammad belonged to the Abu Aqil family of the Banu Awf, one of the two principal branches of the Thaqif. The Abu Aqil family gained prestige with the rise of
al-Hajjaj ibn Yusuf, the paternal first cousin of Muhammad's father al-Qasim ibn Muhammad ibn al-Hakam. Al-Hajjaj was made a commander by the Umayyad caliph
Abd al-Malik () during the
Second Muslim Civil War and killed the Umayyads' chief rival for the caliphate,
Abd Allah ibn al-Zubayr, in 692, and two years later was appointed the viceroy of Iraq and the eastern Caliphate. Following his promotion, al-Hajjaj became a patron of the Thaqif and appointed several members to important posts in Iraq and its dependencies. Muhammad's father was appointed the deputy governor of
Basra, though his career was otherwise undistinguished. According to a letter between Muhammad and al-Hajjaj cited by the
Chach Nama, Muhammad's mother was a certain Habibat al-Uzma (Habiba the Great). The
Chach Nama also indicates Muhammad had a similar-aged brother named Sulb and Arabic sources indicate he had a much younger brother named al-Hajjaj, who served as an Umayyad commander during the
Alid revolt of 740. No information is provided by the
Arabic sources about Muhammad's childhood and adolescence. The modern historian
Nabi Bakhsh Baloch holds that Muhammad most likely grew up partly in Ta'if and then Basra and
Wasit, the provincial capital of Iraq founded by al-Hajjaj in 702. Muhammad's time in Basra, a military and intellectual centre of the Islamic world at the time, may have widened Muhammad's career horizons, while at Wasit he was likely educated and trained under al-Hajjaj's patronage. Al-Hajjaj was highly fond of Muhammad, and considered him prestigious enough to marry his sister Zaynab, though she preferred the older Thaqafite al-Hakam ibn Ayyub ibn al-Hakam, to whom she was ultimately wed. The
Kitab al-Aghani refers to Muhammad at the age of 17 as "the noblest Thaqafite of his time". In the summation of Baloch, "Muhammad grew up under favourable conditions into an able, energetic and cultured lad of fine tastes". ==Governor of Fars==