The 11th century positioned the Iberian Peninsula at a dramatic precipice, defined by the instability of the southern Islamic Taifas and the determination of the northern Christian kingdoms, led by Leon and Castile, to initiate the arduous Reconquista. A critical divergence occurred early: the powerful Almoravid movement in the Maghreb faltered after the death of Yusuf ibn Tashfin, collapsing by 1061, thus eliminating a vital external consolidating force for Al-Andalus. The vacuum was filled by Sa’d ibn al-Walid al-Tulaytuli, a warrior from Toledo dedicated to Muslim centralization. When the Emir's financial incompetence led to Alfonso VI of Leon and Castile sacking Toledo in 1079, Sa’d and his military order, Al-Saff al-Muwahhad, successfully repelled the invasion. Sa’d subsequently arrested the inept Emir and established himself as the new ruler, implementing crucial financial and military reforms. This strength allowed him to unify Al-Andalus by 1101, leading him to heavily fortify the settlement of Madjrit (Madrid), which he proclaimed the new capital and the Emirate of Madjrit in 1105.
For the next two centuries, constant warfare raged, but Madjrit's pragmatic governance, marked by fiscal frugality and openness to new tactics, allowed it to surpass its fragmented opponents. The balance of power permanently shifted to the Muslims, resulting in the systematic conquest of Christian holdings: Leon fell in 1371, Asturias in 1390, and the entire western coast was secured by 1400. The last Christian holdout was mountainous Catalonia. The definitive end came during the ‘Final War of Consolidation’ (1485–1488) when France intervened to "save" Catalonia but was soundly defeated by Madjrit. The ensuing treaty forced France to recognize Madjrit’s borders, leading to the absorption of Catalonia and the relinquishing of Perpignan and Narbonne. This cemented Madjrit’s absolute dominance over Iberia, leading to the realm being proclaimed the Sultanate of Madjrit in 1490.
The Sultanate immediately pivoted its focus outward, first to North Africa to secure its regional defense. Morocco was conquered by 1515, but subsequent campaigns into Tunisia and Libya (starting 1523) proved difficult, with French military intervention reversing Madjriti influence in Tunisia by the Treaty of Lyon in 1540. Simultaneously, Madjrit secured its position in the Atlantic, discovering and settling Atlantic islands like Juzur al-Kashf (the Azores) in 1437 and Juzur al-Brufidans (the Cape Verde islands). This led to establishing a chain of forts along the West African coast, starting with God’s Grace in Guinea in 1496, which provided Madjrit with a strict monopoly over the region’s valuable gold, ivory, and slaves.
In pursuit of a direct trade route to Asia, bypassing hostile intermediaries, Ahmad ibn Rashid al-Gharnati led an expedition that successfully rounded the tip of Africa (August 1499) and reached Cochin, India, in December 1499. The King of Cochin swore an "oath of alliance" to the Sultan in February 1500. When Madjrit returned in 1502 to find Cochin besieged by Calicut, Rashid al-Gharnati brutally bombarded and destroyed Calicut, establishing Madjrit as a disruptive and feared power in the Indian Ocean. Madjriti naval supremacy was secured at the Battle of Daman in 1513, where their superior fleet decimated the combined forces of Gujarat and Egypt. Through strategic conquest, Madjrit secured key ports and the vital chokepoint of the Gulf of Aden by 1543. By the 1560s, the Sultanate enforced a complete monopoly over the regional spice trade by mandating trade permits (Tijara), thereby accumulating immense wealth and solidifying its status as a global empire.