I can only speak about US law, but there has been repeated case law that the police do not have a duty to protect any person in particular (except possibly when people are in their custody which isn't really relevant here).
The function of the police isn't to stop criminals in the act - given their response times that's largely impossible anyhow (well, outside of traffic violations). They largely deter crime by catching criminals after the fact.
The examples given like military facilities have secure fences, 24 hour guards, etc. They are actually secure facilities. As opposed to someone's driveway.
Unless you are an MP, that stuff stays in the armory cage. And if you are headed to the range, ammunition is delivered separately to the range and systems are stringently checked for ammo before returning, afterwards they will do a lockdown inspection of the barracks and everyone's personal vehicles.