the papal bull Manifestis Probatum, Pope Alexander III recognized Afonso Henriques as King of Portugal in 1179. With Portugal finally recognized as an independent kingdom by its neighbours, Afonso Henriques and his successors, aided by Crusaders and the military monastic orders the Knights Templar, the Order of Aviz or the Order of Saint James, pushed the Moors to the Algarve on the southern coast of Portugal. After several campaigns, the Portuguese part in the Reconquista came to an end with the definitive capture of the Algarve in 1249. With all of Portugal now under the control of Afonso III of Portugal, religious, cultural and ethnic groups became gradually homogenized. After the completion of the Reconquista, the Portuguese territory was a Roman Catholic realm. Nonetheless, Denis of Portugal carried out a short war with Castile for possession of the towns of Serpa and Moura. After this, Denis avoided war. In 1297, he signed the Treaty of Alcanizes with Ferdinand IV of Castile, establishing a permanent border between the two kingdoms. During the suppression of the Knights Templar all over Europe, under the influence of Philip IV of France and Pope Clement V requesting its annihilation by 1312, King Denis reinstituted the Templars of Tomar as the Order of Christ in 1319. Denis believed that the Order's assets should by their nature stay in any given Order instead of being taken by the King, largely for the Templars' contribution to the Reconquista and the reconstruction of Portugal after the wars. The experience gained during the battles of the Reconquista was fundamental to Conquest of Ceuta, the first step to the establishment of the Portuguese Empire. Likewise, the contact with Muslim's navigation techniques and sciences enabled the creation of Portuguese nautical innovations such as the caravel – the principal Portuguese ship during their voyages of exploration in the Age of Discovery. Minor Christian realms Minor Christian realms were the Kingdom of Viguera (970–1005), the Lordship of Albarracín (1167–1300), the Principality of Tarragona (1129–1173), and the Principality of Valencia (1094–1102). Southern Islamic realms Umayyads During the 9th century the Berbers returned to North Africa in the aftermath of revolts. Many governors of large cities distant from the capital, Córdoba, had planned to establish their independence. Then, in 929, the Emir of Córdoba (Abd-ar-Rahman III), the leader of the Umayyad dynasty, declared himself Caliph, independent from the Abbasids in Baghdad. He took all the military,