Situation changed when Pisa and the Visconti of Milan declared war to Florence; in 1342 Malatesta and Galeotto were hired to command the Florentine army at the head of 200 men-at-arms, but with scarce success.
When the latter fled to Avignon, they also turned Ghibellines and obtained the title of Imperial vicars, managing soon to capture Ancona, Jesi, Ascoli and Senigallia, and stripping Ferrantino of his last possession, Montiano.
In 1351, Galeotto returned from the Holy Land, and they were called to the Kingdom of Naples to suppress the ruthless Grande Compagnia led by Fra' Moriale.
At the same time, Pope Innocent VI sent the strong Cardinal and general Gil de Albornoz to settle forever the anarchy in the Papal Romagna.
Malatesta had to submit, but maintained most of his lands with the nominal title of vicar; he thenceforth collaborated in the Papal suppression of the remaining independent petty lords of Romagna, as well as in the war against Bernabò Visconti in the defence of Bologna, at the command of an army mostly composed of Hungarian mercenaries.