During a war between Emperor Charles IV and Stephen II, Duke of Bavaria, Louis intervened on the duke's behalf and the Hungarian army invaded Moravia. After the duke and the emperor signed a peace treaty, Louis and the emperor agreed upon the betrothal of their children early the next year. The Ottomans annihilated the Serbian armies in the Battle of Marica on 26 September 1371. Lazar Hrebeljanović, one of the Serbian lords, swore loyalty to Louis. Pope Gregory XI urged Louis to resist the Ottomans but also pleaded with him to send reinforcements to Italy to fight against Bernabò Visconti. A war broke out between the Republic of Venice and Francesco I da Carrara, Lord of Padova, who was an ally of Louis, in the summer of 1372. Louis sent reinforcements to Italy to assist Francesco da Carrara. The Venetians defeated the Hungarian troops at Treviso and captured its commander, Nicholas Lackfi, forcing Louis I to sign a peace treaty on 23 September 1373.