In spite of having entered its golden age, Ferrara was severely hit by a war against Venice fought and lost in 1482–84. Alfonso I succeeded to the throne in 1505 and married the notorious Lucrezia Borgia. He again fought Venice in the Italian Wars after joining the League of Cambrai. In 1509 he was excommunicated by Pope Julius II, but was able to overcome the Papal and Spanish armies in 1512 at the Battle of Ravenna. These successes were based on Ferrara's artillery, produced in his own foundry which was the best of its time.