Think about it realistically. Maybe you can think that the city garrisons are actually not attacking from the city, but sallying out to harass their flanks, then retreat. Then, since locals of a city probably know their surroundings quite well, they can cross mountains in small numbers (cities dont do that much damage), then hit and run back to the city, through the mountains where the large armies wont dare to cross.