What if one of the roman emperors introduced a militia for the city of Rome, for defensive means.
It would be quite a shock for the roman lifestyle, but on the other hand Rome had a huge population, so already a small percentage of inhabitants would generate a strong force able to protect and defend the town.
I know there are some problems. No emperor would like to see the people armed and then interfere with his politics, as well as the senate or the praetorian guard.
But even if the risk would be high for the ruling classes, the benefit for the population would be clear at least in the last days of the Empire. When the Visigoths sacked Rome in 410 they were only 30.000 against a population of nearly one million.