Sanhedrin 77b: Rava said: If a murderer shot an arrow at his victim, and the victim was holding a shield, and someone came and took it away, or even if the murderer himself came and took it away, he is exempt from punishment, because at the time he shot the arrow there was something blocking it.
Rav Papa said: If a murderer tied down his victim and then opened a water stream over him, it is as if he shot an arrow at him and he is liable.
סנהדרין עז ע”ב: ואמר רבא: זרק חץ, ותריס בידו, ובא אחר ונטלו, ואפילו הוא קדם ונטלו ־ פטור, דבעידנא דשדייה ביה ־ מיפסק פיסקיה גיריה.
אמר רב פפא: האי מאן דכפתיה לחבריה ואשקיל עליה בידקא דמיא ־ גירי דידיה הוא, ומיחייב. הני מילי ־ בכח ראשון, אבל בכח שני ־ גרמא בעלמא הוא.
In 1934, Rabbi Chaim Ozer Grodzinski was asked about electric lights on Shabbos. He was shown a journal called Beis Vaad Lachachamim, printed in New York in 1903, in which there appeared a short letter by Rabbi Yechiel Michel Halevi Epstein, author of the Aruch Hashulchan. The Aruch Hashulchan argued that it should be permitted to turn on an electric light on Yom Tov because the fire is already present in the wires. Then he added a second argument that would apply to Shabbos too: when one turns on the switch, he is not creating the fire, only allowing it to reach the bulb, which would be considered “grama” (an indirect action). The Gemara in Shabbos 120b quotes the posuk, “You shall not do any work,” and says, “Doing is forbidden, but indirectly causing is permitted.” Thus one may make a wall of barrels full of water around a fire, so that when the fire reaches them it will be extinguished.
Reb Chaim Ozer explains that the Aruch Hashulchan’s second argument seems to be based on the Gemara in Sanhedrin 77b, which says that the one who took away the shield, allowing the arrow to hit the victim, is exempt. So too, when one turns on a light switch, he is not creating the electric power that goes to the bulb. That power is already in the wires, ready to shoot out. He is just bridging the gap in the circuit.
However, argues Reb Chaim Ozer, the electricity is more similar to the other case in that Gemara, in which someone opens a water stream to kill his victim. The Yad Ramah explains the difference between the two cases: At the time one removes the shield, the arrow is not here yet, but at the time one removes the obstacle in the water stream, the water is pressing up against the obstacle, ready to flow. Here too, the electricity is in the wire ready to flow as soon as the gap is bridged; so it is not “grama”.
Furthermore, even if we were to consider turning on the switch a “grama”, not every “grama” is exempted on Shabbos. The Gemara says in Bava Kama 60a says that winnowing the grain is an act of work on Shabbos, even though the person is just throwing the grain into the air and the wind is doing the job of separating out the chaff. Based on this, the Even Haozer (Orach Chaim 328) argues that pouring wheat into a grinder powered by a water wheel is an act of work (not as the Magen Avraham rules in Orach Chaim 252:20). The rule is that if one is doing the work normally, and the other power helping him (wind, water etc.) is part of his plan, then the Torah categorizes it as work, unlike the case of putting out a fire with a wall of full barrels, which is a unusual method, resorted to on the spur of the moment. Therefore, turning on an electric switch, though it may be “grama”, is the normal way, and would therefore be forbidden.
Source: Achiezer v. 3 siman 60