Muhammad ibn Abd al-Malik al-Tawil (, died 913 or 914) was a Muwallad Wāli of Huesca and a prominent Muslim lord in the Upper March (, Aṯ-Ṯaḡr al-Aʿlà) of Al-Andalus in the late-ninth and early-tenth centuries. Acting autonomously from his nominal masters the Emirs of Córdoba, he carried out his own foreign policy and fought both Christian and Muslim regional rivals, including the Counts of Barcelona, Pallars and Aragon, the King of Pamplona and the Banu Qasi of the Upper March. From him arose a short-lived dynasty, the Banu al-Tawil (), who would rule Huesca, Barbastro and Lleida, off and on, for a century, eventually losing out to the Banu Tujib of Zaragoza. Background Muhammad al-Tawil was son of Abd al-Malik ibn Abd Allah ibn Shabrit, a local lord in the region of Huesca. He was a scion of the Banu Shabrit clan (), the descendants of Shabrit, a late-eighth-century relative and ally of rebel Amrus ibn Yusuf. On 12 March 887, Muhammad killed the great-grandson of Amrus, Mas'ud ibn Amrus, governor of Huesca, and seized power there. Rivalry with the Banu Qasi In 889/90, Isma'il ibn Musa of Lleida, a member of the rival Banu Qasi, rose in rebellion against the Emirate. Muhammad ambushed an army led by Isma'il's sons, Musa and Mutarrif, leading to the death of Musa and 300 of his soldiers and the capture of Mutarrif. This defeat and the subsequent death of Isma'il ended the rebellion and al-Tawil petitioned the Emir to be given the lands of Isma'il. Instead emir Abd Allah returned the territory to the Banu Qasi, specifically to Muhammad ibn Lubb al-Qasawi, nephew of the rebel. In 893, al-Tawil witnessed a charter of king Fortún Garcés of Pamplona, appearing as 'pagan' Mohomat Atavel in Osca along with his rival Muhammad ibn Lubb. Three years later he again came to blows with the Banu Qasi. Muhammad al-Tawil mobilized his troops to oppose plans by Lubb ibn Muhammad, the son of the Banu Qasi head, to fortify or refortify Monzón. They fought a battle in which Lubb's undermanned and poorly equipped army was nonetheless able to rout the men of al-Tawil and capture his brother Furtun. In 898, the death of Muhammad ibn Lubb al-Qasawi while besieging Zaragoza presented Muhammad al-Tawil with an opportunity to recover lost ground, but Lubb ibn Muhammad returned from negotiations with another Muwallad rebel, Umar ibn Hafsun, to again