However in 1008, a civil war broke out and he was forced to emigrate, first to Cueta in 1008 with the Hammudids, then to the Taifa of Zaragoza, where he started work as vizier-secretary and court poet for Mundir I in 1018.