The Talmud discusses prohibitions connected to idolatry and introduces the principle that even permitted actions may be forbidden in certain contexts due to marit ayin — so that onlookers will not suspect one of idol worship.
יָשַׁב לוֹ קוֹץ בִּפְנֵי עֲבוֹדָה זָרָה — לֹא יִשְׁחֶה וְיִטְלֶנָּה, מִפְּנֵי שֶׁנִּרְאֶה כְּמִשְׁתַּחֲוֶה לַעֲבוֹדָה זָרָה, וְאִם אֵינוֹ נִרְאֶה — מוּתָּר. נִתְפַּזְּרוּ לוֹ מְעוֹתָיו בִּפְנֵי עֲבוֹדָה זָרָה — לֹא יִשְׁחֶה וְיִטְּלֵם, מִפְּנֵי שֶׁנִּרְאֶה כְּמִשְׁתַּחֲוֶה לַעֲבוֹדָה זָרָה, וְאִם אֵינוֹ נִרְאֶה — מוּתָּר. מַעְיָין הַמּוֹשֵׁךְ לִפְנֵי עֲבוֹדָה זָרָה — לֹא יִשְׁחֶה וְיִשְׁתֶּה, מִפְּנֵי שֶׁנִּרְאֶה כְּמִשְׁתַּחֲוֶה לַעֲבוֹדָה זָרָה, וְאִם אֵינוֹ נִרְאֶה — מוּתָּר. פַּרְצוּפוֹת הַמְקַלְּחִין מַיִם לִכְרַכִּין — לֹא יַנִּיחַ פִּיו עַל פִּיהֶם וְיִשְׁתֶּה, מִפְּנֵי שֶׁנִּרְאֶה כִּמְנַשֵּׁק לַעֲבוֹדָה זָרָה. כַּיּוֹצֵא בּוֹ — לֹא יַנִּיחַ פִּיו עַל סִילוֹן וְיִשְׁתֶּה, מִפְּנֵי הַסַּכָּנָה. מַאי ״אֵינוֹ נִרְאֶה״? אִילֵּימָא דְּלָא מִתְחֲזֵי, וְהָאָמַר רַב יְהוּדָה אָמַר רַב: כׇּל מָקוֹם שֶׁאָסְרוּ חֲכָמִים מִפְּנֵי מַרְאִית הָעַיִן, אֲפִילּוּ בְּחַדְרֵי חֲדָרִים אָסוּר! אֶלָּא אֵימָא: אִם אֵינוֹ נִרְאֶה כְּמִשְׁתַּחֲוֶה לַעֲבוֹדָה זָרָה — מוּתָּר.
The baraita continues: If a thorn became imbedded in one’s foot while he was standing before an object of idol worship, he may not bend down and remove the thorn, because he appears to be bowing down to the object of idol worship; but if he is not seen, it is permitted. If one’s coins were scattered while he is before an object of idol worship, he may not bend down and pick them up, because he appears to be bowing down to the object of idol worship; but if he is not seen, it is permitted. Likewise, if there is a spring that runs before an object of idol worship, one may not bend down and drink from it, because he appears to be bowing down to the object of idol worship; but if he is not seen, it is permitted. With regard to figures of human faces [partzufot] that spray water in the cities, i.e., fountains, one may not place his mouth on the mouths of the figures and drink, because he appears to be kissing the object of idol worship. Similarly, one may not place his mouth on a pipe [sillon] and drink, here due to the danger that this practice poses. The Gemara asks: What does the baraita mean when it states: If he is not seen? If we say it means that he is not seen by others, doesn’t Rav Yehuda say that Rav says: Wherever the Sages prohibited an action due to the appearance of prohibition, it is prohibited even in the innermost chambers where no one will see it, as the Sages did not distinguish between different circumstances in such cases. Accordingly, the fact that he is not seen by anyone should make no difference with regard to whether or not the action is prohibited. Rather, say: If he is not seen as one who bows down to an object of idol worship, i.e., he turns his side or back to the idol, then it is permitted.