the new city grew rapidly due to the influence of the powerful greek city-state of syracuse , and became an ally of the roman republic against carthage ; the strong walls surrounding neapolis stopped the invading forces of the carthaginian general hannibal from entering .