 In 729 the city repulsed the Saracens; but in 859 and again in 880 the Saracens pillaged and burned it, and for most of the 10th century remained masters of the surrounding country.During the Middle Ages, Nice participated in the wars and history of Italy.As an ally of Pisa it was the enemy of Genoa, and both the King of France and the Holy Roman Emperor endeavoured to subjugate it; but in spite of this it maintained its municipal liberties.