If you yourself may not perform a melachah, you may not ask a non-Jew to perform it for you. This is true both for biblically prohibited acts, melachot de’oreita, and rabinically prohibited acts, melachot de’rabbanan. This applies even if the non-Jew was instructed before Shabbat to perform the melachah on Shabbat.
This prohibition, known as amira lenochri, was established by the rabbis for three reasons. First, they were concerned that by permitting the non-Jew to perform the melachah the Jew might come to perform the melachah himself. Second, appointing a non-Jew as an agent to perform the melachah renders the Jew liable as principal. Third, the prophet Isaiah warns Israel to refrain from discussing melachot on Shabbat. Amira lenochri involves such prohibited discussion.
If the Jew did not request it, but the non-Jew performed the melachah, of his or her own accord, may the Jew benefit from the outcome? The answer is that if the non-solicited melachah provides direct benefit to the Jew, one may not benefit from it unless the melachah was performed primarily for the benefit of the non-Jew. Accordingly, a Jew may not benefit from a light turned on by a non-Jew on Shabbat, thereby enabling the Jew to read, unless the non-Jew turned it on to read himself. The Jew, however, may benefit from a non-Jew turning the light off, thereby making it easier for the Jew to sleep. This is because it is possible, though not desirable, to sleep with the light on and the benefit is therefore considered indirect.
Further, a Jew may benefit from the unsolicited melachah of a non-Jew where such melachah merely provides additional benefit to an already existing benefit, such as turning on additional lights in an already lit room. Whenever benefit is forbidden, the prohibition lasts the entire Shabbat and continues after Shabbat ends for the duration of time it took the non-Jew to perform the melachah on Shabbat. Accordingly, a car delivered for repair to a non-Jewish mechanic just before Shabbat, with instructions to have it ready immediately after Shabbat, and on which the mechanic worked, all day Shabbat, may not be used until Sunday.
Hinting to a non-Jew to perform a melachah is permitted where such melachah causes indirect or additional benefit but not direct benefit. Hinting, in such circumstances, is permissible on condition that the language used includes no command and no mention of the melachah involved. Accordingly, one may not say to a non-Jew “Please help me, I cannot turn off the lights on Shabbat.” One may, however, say, “It is difficult for me to sleep with the lights on.”
Because the prohibition of amira lenochri is of rabbinical origin, there is considerable flexibility in its application. This is particularly the case when the act performed by means of amira lenochri is in itself only a melachah de’rabbanan. Accordingly, the prohibition of amira lenochri is relaxed in order to prevent substantial financial loss; to enable the performance of a mitzvah; in cases of sickness; or in the case of the inevitable unwanted melachah, psik reishe.
Thus one may ask a non-Jew to perform the following acts on one’s behalf on Shabbat: to reconnect a freezer stocked with expensive food that became disconnected on Shabbat, the case of financial loss; to reheat previously cooked food essential for a Shabbat meal by placing it directly on the flame and to turn the lights on in the synagogue to enable the congregants to pray – both cases of performance of a mitzvah, i.e. participating in the Shabbat meal and prayer; to cook previously uncooked food for a sick person; to turn up the heat for persons suffering from cold; to turn on a light for a child who is frightened of the dark, because, for the purpose of amira lenochri, persons suffering from cold and children who suffer are deemed to be “sick”; or to open the refrigerator door, even if this will be sure to activate a light that one forgot to deactivate before Shabbat, the case of psik reishe.