Habus was a builder as well as a warrior. He is the putative founder of the old Kasba, or citadel, in the Albaicin quarter, which was added to by his heir, Badis, who succeeded him in rule. The king is also said to have built the Casa del Gallo de Viento, in the same quarter, where he probably resided. Badis proved an ambitious and warlike monarch, for he enlarged his dominions widely, and even subdued the resolute hillfolk of the Alpujarras. He conquered Malaga, and made plans to besiege Seville. But his force was routed at Cabra by the famous Cid Campeador, Ruy Diaz de Bivar, the ally of the sultan of that city. To Badis is attributed a persecution of the Jews, who numbered several thousands in Elvira, and a terrible slaughter decimated their ranks.

At the advent of the Almoravides, a fierce sect of Northern Africa, Granada was captured (1090) by Abd-ul-Aziz. The city now rose in importance. Soon after the Almoravide settlement, the followers of Islam in Granada attacked the Christians of the city and destroyed their church by fire. The unfortunate Christians appealed for help to Alfonso of Aragon, and the king came to their relief at the head of a strong army. In the combat at Anzul the Almoravides were worsted. Alfonso before retiring laid waste the fertile plain, and left the Christians to make the best of their position. His action had little effect upon the Almoravides, for in 1126 numbers of Christians were banished to Barbary and the rest bitterly oppressed.

The doom of the Almoravides came in 1148. A mightier host, the rapacious and fanatical Almohades, surged over the city. The Moorish inhabitants, strengthening their forces with the aid of Christians and Jews, invited Ibrahim Ibn Humushk to lead them to the expulsion of the new sectaries. The invaders took refuge in the Kasba, and sought relief from Africa, whence an army was despatched. This force was beaten by Humushk, and the Granadines secured the assistance of the Sultan of Murcia and Valencia, whose troops attacked the Kasba, which was held by the Almohades. On the arrival of a second army, they made a sally and inflicted severe losses upon the soldiers of the sultan and his Christian allies. After this success, the Almohades endeavoured to pacify the unruly among their neighbours. Their governor, Sidi Abu Abrahim Ishak, was a tactful and benevolent leader. He improved the city, built a palace for himself, and made the Kasba a stronger fortress. The power of the Almohades was, however, insecure. Ben Hud, a potent chieftain, who had gained a strip of territory on the coast, now discerned that the hour was ripe for an assault upon Cordova, Jaen, and Granada. His domination was not permanent. Mohammed al Ahmar, uniting with the foes of Ben Hud, held Seville for a brief space, and then drove his rival to Almeria, where he was murdered in 1237.

Granada now came under the sway of Al Ahmar, and in the hour of his triumph he was proclaimed monarch of a large part of southern Spain. For two hundred and fifty years the State founded by him resisted the Christian hosts. Granada rose to the zenith of power and prosperity. Its first sultan was a man of high character, courteous, dignified, and astute. He reigned long, and spent himself in affairs of government and in military enterprises, though he used every means to maintain peace.

Al Ahmar's last expedition was undertaken against the Spanish forces and the governors of Guadix and Malaga (their allies) when he was eighty years of age, and failing in strength through illness. A fall from his horse brought him to his end. He expired in the arms of his ally, the Infante Don Felipe, and under cover of darkness his body was borne to Granada, where it was entombed in the burial ground of Assabica.

The sovereignty now descended to Al Ahmar's son, named Mohammed II., who ascended the throne in 1273. He was renowned for his wisdom in the law, and during his reign of twenty-nine years he proved a worthy son of a great father.