המכבה הנר מפני שהוא מתירא מפני עכו"ם וכו' משנה בפרק במה מדליקין (שבת כט:) המכבה את הנר מפני שהוא מתירא מפני עכו"ם מפני ליסטים מפני רוח רעה או בשביל החולה שישן פטור ומפרש בגמרא (לא:) דמתניתין ר' יהודה היא דאמר מלאכה שאינה צריכה לגופה חייב עליה ומתניתין בחולה שיש בו סכנה ובדין הוא דליתני נמי מותר ואיידי דבעי למיתני סיפא חייב תנא נמי רישא פטור אבל אם אין בו סכנה חייב חטאת הוא אבל לר"ש בחולה שיש בו סכנה מותר ובחולה שאין בו סכנה פטור משום דס"ל מלאכה שאינה צריכה לגופה פטור עליה ורבינו פוסק כר"ש וכדעת הרמב"ן שכתב הר"ן בסוף שבת וגם הוא ז"ל העלה כן בפרק המצניע וגם הרב המגיד כתב בפ"א שכן דעת האחרונים אבל הרמב"ם פסק שם כרבי יהודה ובכוונת הרי"ף כתב הר"ן בהמצניע דס"ל כר"ש והרב המגיד כתב בפ' הנזכר שכן דחק לומר הרמב"ן ושכן דעת הרשב"א ואע"פ שממה שכתב בפרק כירה נראה שפוסק כר' יהודה: One who extinguishes a lamp out of fear of the gentiles, etc. The Mishnah in chapter "With What do We Light? (Shabbat 29b)" reads: "One who extinguishes a lamp because he fears the gentiles, because of bandits, because of an evil spirit, or so that a sick person may sleep is exempt." The Gemara explains (31b) that the Mishnah is according to Rabbi Yehudah, who said that a melachah she'einah tzrichah legufah incurs a sin offering, and that the Mishnah refers to a sick person in mortal danger. Then, it would make sense for the Mishnah to say "allowed (instead of 'exempt')." Since the end of the Mishnah needed to teach "incurs a sin offering," the beginning of the Mishnah taught "exempt." But if the sick person is not in mortal danger, extinguishing a lamp for them incurs a sin offering. But according to Rabbi Shimon, doing this for a sick person in mortal danger is permitted, and a for a sick person not in mortal danger, one is exempt, as he holds that we are exempt from penalty when we perform a melachah she'einah tzrichah legufah. Our rabbis rule like Rabbi Shimon, and according to the Ramban, as the Ran wrote at the end of Tractate Shabbat, and he, of blessed memory, said so in chapter "One who Hides...." (chapter 10), that he holds like Rabbi Shimon. The Rambam wrote in Chapter 1 of Hilchot Shabbat (Mishneh Torah) that this is the opinion of the later rabbis, but the Rambam himself ruled like Rabbi Yehudah. In accordance with the Rif, the Ran wrote in the tenth chapter of Tractate Shabbat that he holds like Rabbi Shimon....and this is the opinion of Rashba, and even though from what he wrote in the third chapter, it seems that he holds like Rabbi Yehudah.