In 1273 and again in 1277, Lucca was ruled by a Guelph (captain of the people) named Luchetto Gattilusio. In 1314, after internal problems Uguccione della Faggiuola of Pisa make himself lord of Lucca. The people of the city made him leave two years later and "condottiere" gain the leadership. In 1325, in the battle of Altopascio, Lucca soldiers defeated Florence's Guelphs with the help of Castracani, a leader of the city in time of war. After they won, Castracani was named "Duke of Lucca" by Louis IV the Bavarian. Until the French Revolution in 1789, Lucca was independent from Venice and Genoa. It was a city controlled by democracy or sometimes by oligarchy.