The founder of the dynasty, 'Ali ibn Buya, was originally a soldier in the service of the Daylamite warlord Makan ibn Kaki, but later changed his adherence to the Iranian ruler Mardavij, who had established the Ziyarid dynasty, and was himself related to the ruling dynasty of Gilan, a region bordering Daylam. 'Ali was later joined by his two younger brothers, Hasan ibn Buya and Ahmad ibn Buya. In 932, 'Ali was given Karaj as his fief, and thus was able to enlist other Daylamites into his army. However, 'Ali's initiative proved too much for Mardavij, who planned to have him killed, but 'Ali was informed of Mardavij's plan by the latter's own "vizier". The brothers, with 400 of their Daylamite supporters, then fled to Fars, where they managed to take control of Arrajan. However, the Buyids and the Abbasid general Yaqut shortly fought for control of Fars, with the Buyids eventually emerging victorious. This victory opened the way for the conquest of the capital of Fars, Shiraz.