 However, Azzo's mercenary forces were defeated in the battle and Azzo himself taken prisoner and subsequently imprisoned by Astorre I Manfredi, commander of the Regency Council forces, thus removing the threat to Niccolò's rule.In 1397 Niccolò married Gigliola da Carrara, daughter of Francesco II da Carrara, lord of Padua.In 1403 he joined the league formed against Gian Maria Visconti, Duke of Milan, being appointed Captain General of the Papal Army by Pope Boniface IX.