I saw a few weeks ago that there are no security checks at the Kotel for religiously dressed Jews on Shabbat. This is to avoid having to walk through a metal detector, apparently.
My question is, why doesn't the metal detector fall under pikuach nefesh? The purpose is literally to save lives from the potential of a terrorist attack. As written in this Q&A:
Rav Neuwirth cites Pri Megadim (328:6) who writes that this is the case even in a case of possible danger to life.
Please provide sources as to the halacha and reasons behind it.
I'd also be curious to know of any special cases -- such as if it's ordinarily assur but allowed if it's the only way into the only shul in town, for example.