In the agony of the Umayyad dynasty in Spain, two princes of the house were proclaimed caliphs for a very short time, Abd-ar-Rahman IV Mortada (1017), and Abd-ar-Rahman V Mostadir (1023-1024). Both were the mere puppets of factions, who deserted them at once. Abd-ar-Rahman IV was murdered the same year he was proclaimed at Guadiz, in flight from a battle in which he had been deserted by his supporters. Abd-ar-Rahman V was proclaimed caliph in December 1023 at Cordova, and murdered in January 1024 by a mob of unemployed workmen, headed by one of his own cousins.