The purpose of Torah and mitzvot is to preserve life. As it says, “Keep My decrees and laws, which a person shall do and live by; I am the Lord” (Leviticus 18:5). God gave us the mitzvot to live, not to die. Therefore, risk to life (piku’aĥ nefesh), meaning the obligation of saving life, supersedes all other mitzvot. This occurs most frequently when people's lives may be in danger, and saving them would involve desecrating Shabbat. In such cases, one must desecrate Shabbat in order to save the life.