In 1060, Pisa engaged in its first battle against Genoa and the Pisan victory helped to consolidate its position in the Mediterranean. Pope Gregory VII recognized in 1077 the new "laws and customs of the sea" instituted by the Pisans, and Holy Roman Emperor Henry IV granted them the right to name their own consuls, advised by a Council of Elders. This was simply a confirmation of the present situation, because at the time the marquis of Tuscany (the nominal feudal sovereign of Pisa) had already been excluded from power. Pisa sacked the Zirid city of Mahdia in 1088. Four years later, Pisan and Genoese ships helped Alfonso VI of Castile force El Cid out of Valencia. In 1092, Pope Urban II awarded Pisa supremacy over Corsica and Sardinia and at the same time elevated the Diocese of Pisa to the rank of metropolitan archdiocese.