Ferdinand was busy in the last decades of his life with the so-called Italian Wars. He was fighting with the Kings of France for control of Italy. In 1494, Charles VIII of France invaded Italy and expelled Ferdinand's cousin, Alfonso II, from the throne of Naples. Ferdinand's alliance with various Italian princes and with Emperor Maximilian I, expelled the French by 1496 and installed Alfonso's son, Ferdinand, on the Neapolitan throne. In 1501, following the death of Ferdinand II of Naples and his succession by his uncle Frederick, Ferdinand of Aragon signed an agreement with Charles VIII's successor, Louis XII. Louis had just successfully asserted his claims to the Duchy of Milan, and they agreed to partition Naples between them, with Campania and the Abruzzi, including Naples itself, going to the French and Ferdinand taking Apulia and Calabria. The agreement soon fell apart, and over the next several years, Ferdinand's great general Gonzalo Fernández de Córdoba conquered Naples from the French, by 1504. Another less famous "conquest" took place in 1502, when Andreas Paleologus, de jure Emperor of the Eastern Roman Empire, left Ferdinand and Isabella as heirs to the empire, thus Ferdinand became de jure Roman Emperor. 