 John then confirmed a treaty with the princes "salve fidelitate sanctorum imperatorum".In 946, he allied with Landulf II of Benevento in an invasion of Salerno with the intent of deposing Prince Gisulf I.They were defeated by an army of Mastalus I of Amalfi and John retired to Naples.