MESIRAS NEFESH FOR IDOLATRY
Gemara
Question: Why were the haters of (this is a euphemism) Yisrael in the days of Mordechai worthy to be destroyed?
Answer (R. Shimon): They bowed to Nebuchadnetzar's image.
Question (Talmidim): (If so, how did they merit to be saved miraculously?) Did Hash-m show partiality?
Answer (R. Shimon): They did not really serve it, they just appeared to do so. Similarly, Hash-m only appeared to decree their destruction - "Ki Lo Anah mi'Libi."
Sanhedrin 74a - R. Yochanan: Chachamim voted and concluded that if a person is told to transgress or else be killed, he may (Rambam - must) transgress. There are three exceptions (for which he must forfeit his life): idolatry, Arayos, and murder.
Question: Is idolatry really an exception?!
Beraisa - R. Yishmael: If a person is told to serve idolatry or be killed, he may (must) transgress. "Va'Chai Bahem", do not die because of Mitzvos.
Suggestion: Perhaps this applies even in public!
Rejection: "V'Lo Sechalelu Es Shem Kodshi v'Nikdashti."
Answer: The majority voted that the Halachah follows R. Eliezer.
(Beraisa - R. Eliezer) Question: ("V'Ohavta Es Hash-m Elokecha..." -) why must it say both "Uv'Chol Nafshecha" and "Uv'Chol Me'odecha"?
Answer: (Even) if a person's life is dearer to him than his money, he must love Hash-m with all his life (idolatry contradicts love of Hash-m);
(Even) if his money is dearer to him than his life, he must love Hash-m with all his money (use all of it to avoid transgressing, if necessary).
Kesuvos 33a - Rav Ashi: Perhaps lashes is harsher than death;
Rav: If Chananyah, Misha'el and Azaryah had been lashed, they would have bowed to the image.
Pesachim 53b (Beraisa - Tudus) Question: Why did Chananyah, Misha'el and Azaryah enter the furnace to be Moser Nefesh?
Answer: They made a Kal va'Chomer from the Tzefarde'im. Even though frogs are not commanded about Kidush Hash-m, "U'Va'u b'Veisecha uv'Sanurecha uv'Mish'arosecha";
Kneading bowls are near ovens when the ovens are hot, still they entered - we are commanded about Kidush Hash-m, all the more so we should enter!
Yoma 82a: Nothing overrides Piku'ach Nefesh except for idolatry, Arayos and murder.
Rishonim
Rif (Sanhedrin 17a) and Rosh (7:3) bring the ruling of R. Yochanan and R. Eliezer's Beraisa.
Ran (Pesachim 6a DH Im): R. Yishmael explains "B'Chol Levavcha uv'Chol Nafshecha" to mean wholeheartedly.
Question: Love of Hash-m is a basis of all Mitzvos. We should expound "uv'Chol Nafshecha" to require Mesiras Nefesh for all Mitzvos!
Answer (Ran ibid.) Since it also says "Va'Chai Bahem", it is reasonable to apply Va'Chai Bahem to all other Mitzvos, and uv'Chol Nafshecha to require Mesiras Nefesh for idolatry. This is because denial of idolatry is the basis of Ahavas Hash-m and is like acceptance of the entire Torah.
Rambam (Hilchos Yesodei ha'Torah 5:1,2): All of Yisrael are commanded about Kidush Hash-m. Regarding idolatry, Arayos and murder, if one is told to transgress or be killed he must submit to be killed.
Ba'al ha'Ma'or (Sanhedrin 17b DH Abaye): One may not benefit from any of the three Aveiros even for Piku'ach Nefesh, e.g. to be cured through wood of an Asheirah. Mesiras Nefesh is never required when the Nochri intends for his own benefit. We learn from Esther. This was in public and it was Arayos, for she was "l'Vas" (a wife) to Mordechai. Similarly, when Nochrim demand that we give them Kelim with coals (for their rituals) on their idolatrous festivals, we comply, because they intend for their own benefit. This applies even at the time of Shemad. However, regarding idolatry itself there is no case where the Nochri wants the Yisrael to serve for the Nochri's benefit. Also, Abaye and Rava do not argue with each other. Both of their answers are true. Even if they argue, the Halachah follows Rava, who permits when the Nochri intends for his own benefit.
Rebuttal (Milchamos Hash-m): R. Tzadok and Rav Kahana were ready to kill themselves rather than sin with Nochriyos who intended for their own benefit (Kidushin 40a). Surely they would not go beyond the letter of the law to kill themselves! It is Asur to heal with wood of an Asheirah even for Piku'ach Nefesh, even though this is for Hana'ah. The Gemara (Yoma 82a) permits eating on Yom Kipur for Piku'ach Nefesh, and says that the same applies to anything except for idolatry, Arayos and murder, i.e. even though this is for benefit. Giving Nochrim coals for their idolatry is not even dust of idolatry; it is only "V'Lifnei Iver Lo Siten Michshol". Mordechai endangered himself and all of Yisrael rather than bow down to Haman because Haman was worshipped. This is even though the decree that people bow to him was for his benefit, i.e. for his honor.
Ran (Yoma 3b DH Chutz): Mesiras Nefesh is required for all auxiliary Isurim of the three Aveiros, even if the Nochri intends for his own benefit.
Rosh (Sanhedrin 8:3): The Gemara (Yoma 82a) says that only idolatry, Arayos and murder override Piku'ach Nefesh. It does not cite R. Yishmael and Rava, who exclude idolatry. This shows that the Halachah does not follow them.
Rosh (Avodah Zarah 2:9): In Avodah Zarah (54a) Rava holds like R. Yishmael, who says that idolatry is not more stringent than other Aveiros. In Kesuvos (19a) Rava holds like Chachamim, who require Mesiras Nefesh for idolatry in every case. It is not clear on which of these we should rely. The Rif and She'altos are stringent, like Chachamim.
Question #1 (Tosfos Kesuvos 33b DH Ilmalei): Why does the Gemara say that if Chananyah, Misha'el and Azaryah had been lashed, they would have bowed to the image? "Uv'Chol Nafshecha" connotes even torture like R. Akiva's death, which was worse than lashes!
Question #2: Why does the Gemara (Pesachim 53b) ask why Chananyah, Misha'el and Azaryah were Moser Nefesh? All agree that one must Moser Nefesh for idolatry in public!
Answer #1 (to both questions - R. Tam in Tosfos ibid.): The image was not idolatry. It was only for the king's honor.
Nimukei Yosef (Sanhedrin 18a DH veha'Mekadesh): People thought that it was idolatry, therefore Chananyah, Misha'el and Azaryah were voluntarily Moser Nefesh to inspire others.
Answer #2 (to Question #2 - Ri in Tosfos Pesachim 53b DH Mah): The Gemara asks why they didn't flee, like Daniel did!
Poskim
Shulchan Aruch (YD 157:1): Regarding idolatry, Arayos and murder, even in private when there is no royal decree against Mitzvos, even if the Nochri intends for his own benefit, one must be Moser Nefesh.
Rema: This is only if they want the Yisrael to do an act, e.g. he must have relations with a woman or kill someone. But if they forcibly have relations with a Yisraelis or throw a person on a baby to kill the baby, or if Reuven had an erection and they want to force his Ever onto an Ervah, he need not be Moser Nefesh. One must be Moser Nefesh for any transgression pertaining to idolatry, Arayos and murder, even a Lav (without Misah), but not for "V'Lifnei Iver Lo Siten Michshol". If one was obligated to be Moser Nefesh, but transgressed, he was Mechalel Hash-m. Nevertheless, he is exempt (from punishment for the Aveirah). This is only if he was not able to flee; if not, he is considered Mezid.
Gra (18): This is like the first answer in Tosfos (Sanhedrin 61b). The second answer says that (in a usual case) one who transgressed is liable.
Beis Yosef (DH v'Kosvu Od): Bereishis Rabah (34:14) forbids suicide from "V'Ach Es Dimchem l'Nafshoseichem Edrosh" (our text learns from "Ach Basar..."). It suggests that this applies even to Chananyah, Misha'el and Azaryah, i.e. at a time of Shemad; "Ach" teaches otherwise.