Question:
In the case of the FBI and Apple. Would Halakhah allow the invasion of privacy (unlocking the phone) if (there was a possibility of saving people from a terrorist attack (Pikuach Nefesh)?
Answer:
Pikuach Nefesh over rides all the prohibitions in the Torah except three, murder, idol worship and immorality.
Sources:
Y:d 157:1