From what I understand based on a handful of books I've read (and that alone), in early Islam, Mosques were routinely used as community centers as much as places of worship. Subsequently, when the community, much more tribal in nature than current times, was at war, the most accessible rally point was the mosque. In such times, the place of worship became an armory. Theorists in my readings have suggested that it's a much more common practice than people perceive.
Again, no offense intended, just throwing out what I've heard.