Our Gemara on Amud Aleph discusses the phenomenon of a sin that was not committed, but only due to technical interference. In other words, the person really wanted to commit the sin, just somehow circumstances prevented him from doing so:

תָּנוּ רַבָּנַן אִישָׁהּ הֲפֵרָם וַה׳ יִסְלַח לָהּ בְּאִשָּׁה שֶׁהֵפֵר לָהּ בַּעְלָהּ וְהִיא לֹא יָדְעָה הַכָּתוּב מְדַבֵּר שֶׁהִיא צְרִיכָה כַּפָּרָה וּסְלִיחָה

The Sages taught with regard to a verse in the section discussing vows: “Her husband has nullified them, and the Lord will forgive her” (Numbers 30:13), that the verse is speaking of a woman whose husband nullified her vow and she did not know that he had done so. It teaches that if she performs the actions prohibited by the vow she requires atonement and forgiveness.

וּכְשֶׁהָיָה מַגִּיעַ רַבִּי עֲקִיבָא אֵצֶל פָּסוּק זֶה הָיָה בּוֹכֶה וּמָה מִי שֶׁנִּתְכַּוֵּון לַעֲלוֹת בְּיָדוֹ בְּשַׂר חֲזִיר וְעָלָה בְּיָדוֹ בְּשַׂר טָלֶה טָעוּן כַּפָּרָה וּסְלִיחָה הַמִּתְכַּוֵּון לַעֲלוֹת בְּיָדוֹ בְּשַׂר חֲזִיר וְעָלָה בְּיָדוֹ בְּשַׂר חֲזִיר עַל אַחַת כַּמָּה וְכַמָּה

And when Rabbi Akiva would reach this verse he would cry, saying: And if one who intended to pick up pork in his hand and eat it, and in fact he picked up the meat of a lamb in his hand and ate it, so that he did not in fact commit a transgression, like this woman who tried to sin and was unaware that her husband had nullified her vow, nevertheless requires atonement and forgiveness, then with regard to one who intends to pick up pork in his hand and in fact picked up pork in his hand, all the more so does he require atonement.

This discussion speaks to the nature of sin.  Is it intention?  Is it action?  Is it both, or is it really the intention, but on a practical level, we need action to create liability because human thought is too variable and fickle. Perhaps this is part of what our sages mean when they said (Yoma 29a):

הִרְהוּרֵי עֲבֵירָה קָשׁוּ מֵעֲבֵירָה, וְסִימָנָיךְ: רֵיחָא דְבִישְׂרָא. 

Thoughts of transgression are worse than transgression itself…The smell of roasting meat is more appetizing than actually eating the meat. 

While technically the sin is only violated in deed, the thought to sin and obsessing about sin might be more spiritually toxic.

The Ishbitzer (Bais Yaakov, Vayyigash 22) has an optimistic take on this idea. He analyzes Yosef’s seemingly false words of comfort to his brothers (Bereishis 45:5-8):

וְעַתָּ֣ה ׀ אַל־תֵּעָ֣צְב֗וּ וְאַל־יִ֙חַר֙ בְּעֵ֣ינֵיכֶ֔ם כִּֽי־מְכַרְתֶּ֥ם אֹתִ֖י הֵ֑נָּה כִּ֣י לְמִֽחְיָ֔ה שְׁלָחַ֥נִי אֱלֹקים לִפְנֵיכֶֽם׃ 

Now, do not be distressed or reproach yourselves because you sold me hither; it was to save life that God sent me ahead of you.

וְעַתָּ֗ה לֹֽא־אַתֶּ֞ם שְׁלַחְתֶּ֤ם אֹתִי֙ הֵ֔נָּה כִּ֖י האלקים וַיְשִׂימֵ֨נִֽי לְאָ֜ב לְפַרְעֹ֗ה וּלְאָדוֹן֙ לְכׇל־בֵּית֔וֹ וּמֹשֵׁ֖ל בְּכׇל־אֶ֥רֶץ מִצְרָֽיִם׃ 

So, it was not you who sent me here, but God—who has made me a father to Pharaoh, lord of all his household, and ruler over the whole land of Egypt.

How is this really supposed to be a comfort to the Shevatim, especially in the light of what Rabbi Akiva stated in our Gemara? The Beis Yaakov explains that Jews do not really sin, in as much as they commit the impertinence of taking action that might be eventually permitted but currently is forbidden. Really all sin will end up having been God’s will, just as the Shevatim’s intentions to thwart Yosef and murder him ended up as actions toward fulfillment of a divine plan.

These kinds of ideas seem far-fetched but are taken seriously by great Jewish theologians. Ben Yehoyada here notes that Rabbi Akiva’s example of a sin is pork. There is a tradition that pork itself will one day revert to a kosher status during Messianic times (as we once Discussed in Psychology of the Daf, Nedarim 58.) But, what does it really mean?

Rav Tzaddok develops this idea extensively (See Peri Tzaddik Vayyigash 8, Takanas Hashavin 5:1, and Tzidkas Hatzaddik 40 and 43). All actions in the world are the will of God; even sin is the will of God. However, since one never knows what sin might be the will of God and what is just sin, on a practical level, it must be resisted with all one’s might. Post facto though, it was God’s will. If so, why is repentance necessary? It is because of what Rabbi Akiva says, the sin is the rebellion and the wish to obey our lusts instead of God. 

He explains sin has two components: Action and intention. If they actions turn out to be a part of God’s plan, then the action is a non-issue. However, the intention remains a stain. Yet, intention is not action so repentance, which also is a thought process and not an action, has the ability to correct the intention as well. Thought cannot change an action but a new thought can change an prior thought. This is how we can understand the statement of Chazal, that the highest form of repentance, done out of love for God and not merely fear of punishment, has the ability to turn sins into mitzvos (Yoma 86b). Once the person achieves a level of devotion that he is totally given over to God’s will, then his rebellious intent is erased and even turned into a positive intent. And since we have an action that ultimately was God’s will, and we match it with a now positive intention, the very sin has become a mitzvah.

We will discuss more about sin and intention in tomorrow’s Psychology of the Daf, Nazir 24.