Sukkah, Chapter 3, Mishnah 14. This mishnah presents the opinion of Rabbi Yosei regarding one who carried his lulav out into a public domain on the first day of Sukkos that fell on Shabbos.
The text of the mishnah:
"Rabbi Yosei omer: yom tov harishon shel hechag shechal lihyos b'Shabbos, v'shachach v'hotzi es halulav lireshus harabim, patur, mipnei shehotzi'o bireshus" - "Rabbi Yosei says: If the first day of the festival fell on Shabbos, and one forgot and carried the lulav out into a public domain, he is exempt, because he carried it out with permission."
As we mentioned in the previous mishnah, in the days of the Mishnah a person would take the lulav even on Shabbos, when the first day of the festival fell on it. However, he may not carry the lulav in a public domain, and such carrying is a violation of Shabbos. Our mishnah therefore deals with someone who forgot and carried his lulav out into a public domain on the first day.
Rabbi Yosei rules: "patur" - he does not bear responsibility for the desecration of Shabbos. Even though he did this unintentionally, and normally a person in such a situation must bring a sin offering to atone for what he did, here he is exempt from the offering. And the reason is: "mipnei shehotzi'o bireshus" - because he carried it out with permission.
What does "bireshus" mean here?
On the face of it, there was certainly no permission to do such a thing. The Gemara explains that Rabbi Yosei holds: one who is engaged in a mitzvah and whose mind is preoccupied with performing it, and who comes to transgress because of that preoccupation, need not bring a sin offering for having desecrated Shabbos.
A limitation on this ruling:
The Gemara clarifies that this exemption applies only as long as he has not yet fulfilled the mitzvah. Once he has fulfilled it, he is like anyone else, since he is no longer preoccupied with a mitzvah he has already performed.
The Gemara asks: how is it possible that he has not yet fulfilled the mitzvah? After all, by the very act of lifting the lulav when he carried it out into the public domain, he already fulfilled his obligation.
The Gemara answers: the case is one who lifted the lulav and carried it out into the public domain while holding it upside down. The halachah is that the four species must be held upright, the way they grow on the trees, and therefore at the moment he carried it out he had not yet fulfilled the mitzvah; only after he went out and carried it in the public domain is he able to fulfill it.
In summary: according to Rabbi Yosei, since he was engaged in a mitzvah and preoccupied with it, even though he desecrated Shabbos unintentionally he need not bring an offering for that desecration, because it was his preoccupation with the mitzvah that brought him to it.