unfamiliar to him, such as appointing and dealing with a Catholic bishop in Toledo and the settling of garrisons in the small Muslim strongholds, the taifas, which were dependent on Toledo and which often bought the king's favour with gold from their trade with Al-Andalus and the Maghreb. Alfonso VI thus found his role as a Catholic king redefined as he governed large cities with sophisticated urban, Muslim subjects and growing Christian populations. The two kingdoms of León and Castile were split in 1157, when a major defeat for Alfonso VII of Castile weakened the authority of Castile. The last two kings of an independent Kingdom of León (1157–1230) were Ferdinand II and Alfonso IX. Fernando II led León's conquest of Mérida, a city dating from Roman times. Alfonso IX, besides conquering the whole of Extremadura (including the cities of Cáceres and Badajoz), was the most modern king of his time, founding the University of Salamanca in 1212 and summoning in 1188 the first parliament with representation of the citizenry ever seen in Europe, the Cortes of León. Alfonso IX did not want his kingdom to disappear upon his death and designated his heirs as Sancha and Dulce, the daughters of his first wife. In order to maintain the independence of the Kingdom of León, Afonso IX applied in his testament the Galician right of inheritance, which granted men and women equality in succession, thus leaving his daughters to be the future queens of León. However, when Alfonso IX died in 1230, his son by Berenguela of Castile, Ferdinand III of Castile, invaded León and assumed the crown. He thus became the first joint sovereign of both kingdoms since the death of Alfonso VII in 1157. The isolated Atlantic province, the County of Portugal, had won independence in 1139 to become the Kingdom of Portugal. The union between León and Castile was not accepted by the Leonese people. King Ferdinand III needed two years to suppress the secessionist revolts in the Kingdom of León, so his son Alfonso X restored the independence of the Kingdom of León. However, this was not respected by his son and successor, Sancho IV, whose brother John waited until 1296, following Sancho's death the previous year, to be crowned as John I, King of León, Galicia and Seville. In 1301, he abdicated, and the king of Castile assumed the Crown of León, reuniting the two