However, Louis' hold over Naples was weak. He initially installed a puppet ruler in Naples (his cousin, Frederick of Aragon), but made a secret arrangement to split the kingdom with King Ferdinand of Spain, who also claimed a hereditary right to Naples. Ferdinand quickly reneged on the agreement and drove the French forces out of Naples. Even so, the French still controlled much of Italy. Cesare Borgia may have threatened French power in Italy after his success in the Romagna region, but his father's sudden death left him without resources or influence.
After Alexander VI's successor, Pius III, died after less than a month in office, Cardinal Giuliano della Rovere became Pope Julius II in 1503. Julius earns several mentions in Machiavelli's narrative. As Machiavelli observes, he was every bit as warlike and ambitious as Alexander, but his goal was always to increase the power of the church, not to aggrandize his own family. Unlike Alexander, he was a good manager of money and resources and exercised restraint in his personal habits. He was also a wily politician.
In the power vacuum left after the collapse of Borgia power, Venice had seized part of the Romagna region, which traditionally belonged to the papacy, and they were also challenging Julius' authority in spiritual matters. In 1508, Julius formed the League of Cambrai, which included France, Spain, and the Holy Roman Empire, for the purpose of putting the Venetians back in their place. The Venetian armies were defeated at the battle of Agnadello (which Machiavelli refers to as Vailà) and Venice's conquered territories were lost. Soon after, Julius, who feared the French's hold over Italy, began working to get them out. During this period, Louis had Julius at his mercy on more than one occasion, but never pressed his advantage, a move that Machiavelli criticizes. Julius' efforts culminated in the formation of the Holy League, which included combined forces of the Venetians, the Holy Roman Empire, the Swiss, the English, and the Spanish. Despite a disastrous defeat at the battle of Ravenna, the League ultimately drove out Louis and his armies in 1512, putting him out of power in Italy. Machiavelli alludes to this fact in Chapter 3 of The Prince when he comments that it took the entire world to deprive Louis XII of his Italian conquests.
The Florentines had been longstanding allies of the French. The Soderini government supported Louis up until the bitter end and against all advice, even as the French were pulling out of Italy. Their loyalty left them at the mercy of Pope Julius and his Spanish allies, and this led directly to the fall of the Florentine republic which Machiavelli had served for so many years.


















