Between June 1640 and November 1642 he was appointed Legate in Bologna which he ruled with his usual authoritative way of acting. During the First War of Castro he closed the doors of Bologna and did not attack the army of Odoardo Farnese, saving the town but actually opposing the Barberini and the pope.