Negative commandment · Lo Ta’aseh #47 of 613
Not to stray after the thoughts of one's heart or the sights one's eyes behold
שלא לתור אחר מחשבות הלב וראיית העיניים
The verse · Bamidbar 15:39
וְהָיָה לָכֶם לְצִיצִת וּרְאִיתֶם אֹתוֹ וּזְכַרְתֶּם אֶת־כׇּל־מִצְוֺת ה׳ וַעֲשִׂיתֶם אֹתָם וְלֹא־תָתוּרוּ אַחֲרֵי לְבַבְכֶם וְאַחֲרֵי עֵינֵיכֶם אֲשֶׁר־אַתֶּם זֹנִים אַחֲרֵיהֶם
“and it shall be to you as a fringe, that you may look upon it, and remember all the commandments of the Lord, and do them; and that you seek not after your own heart and your own eyes, after which you go astray:”
The Rambam’s words
Not to stray after the thoughts of one's heart or the sights one's eyes behold, as [Numbers 15:39] states: "Do not stray after your heart and eyes."
שלא לתור אחר מחשבות הלב וראיית העיניים, שנאמר "ולא תתורו . . ." (במדבר טו,לט).
Why · Sefer HaChinuch #387
To not wander after the thoughts of the heart and the vision of the eyes
“The root of this commandment is revealed, as through it a person is protected from sinning against G-d all his days. This commandment is really a fundamental principle in the religion, as evil thoughts are the progenitors of impurities, and the actions are their descendants.”
Who & when
“And this commandment is practiced in all places and at all times by men and women.”
Where in the Mishneh Torah
Hilchot Foreign Worship and Customs of the Nations הלכות עבודה זרה וחוקות הגויים