Yahya was a son of al-Hakam ibn Abi al-As and a younger half-brother of Caliph Marwan I (r. 684–685).[1][2] His mother hailed from the Banu Murra tribe of Ghatafan.[1] He fought alongside Marwan and their other brother Abd al-Rahman and other senior Muslim leaders of the Quraysh against Caliph Ali (r. 656–661) at the Battle of the Camel in 656.[1][2] Ali was victorious and Yahya, wounded, found safety with a member of the large Banu Tamim tribe in Basra.[1] This tribesman escorted him to the headquarters of his distant cousin, the governor of Syria, Mu'awiya ibn Abi Sufyan, in Damascus.[1] He stayed in the city through the course of Mu'awiya's caliphate (661–680) and that of his son and successor, Yazid I (r. 680–683).[1] Yahya publicly condemned the slaying of Ali's son and the Islamic prophet Muhammad's grandson, Husayn, by Yazid's army at the Battle of Karbala in 680.[1]