In 1796, Napoleon commanded a French army that defeated the larger armies of Austria, one of his country's primary rivals, in a series of battles in Italy. In 1797, France and Austria signed the Treaty of Campo Formio, resulting in territorial gains for the French.