In the period from June to August 1944, the Allies advanced beyond Rome, taking Florence and closing up on the Gothic Line. This last major defensive line ran from the coast some north of Pisa, along the jagged Apennine Mountains chain between Florence and Bologna to the Adriatic coast, just south of Rimini. In order to shorten the Allied lines of communication for the advance into Northern Italy, the Polish II Corps advanced towards the port of Ancona and, after a month-long battle, succeeded in capturing it on 18 July.