After the destructions inflicted by Frederick Barbarossa in 1162, in few years the Milanese reconstructed their city and defeated the emperor at Legnano in 1176, forcing him to the Peace of Constance, which granted autonomy also to the cities allied to Milan.