It was only after these events that it was decided to fortify the Basilica with walls. The fortification was ordered by Pope Leo IV, which is why the Basilica and its buildings were called the Leonine City.
The graphic shows the appearance of the Leonine City around 1350, some 150 years before construction began on the new St. Peter's Basilica in Rome.Public domain