In 1209 in Lerici, two councils for a final resolution of the rivalry with Genoa were held. A 20-year peace treaty was signed, but when in 1220, the emperor Frederick II confirmed his supremacy over the Tyrrhenian coast from Civitavecchia to Portovenere, the Genoese and Tuscan resentment against Pisa grew again. In the following years, Pisa clashed with Lucca in Garfagnana and was defeated by the Florentines at Castel del Bosco. The strong Ghibelline position of Pisa brought this town diametrically against the Pope, who was in a strong dispute with the Empire, and indeed the pope tried to deprive the town of its dominions in northern Sardinia.