Our Mishna discusses a case of partners in a bor (a hole or ditch). If the first one makes use of it without covering it and then the second one does the same, the second one will bear responsibility for any damage caused by the open pit, since he was the last one to use it.
The Gemara searches for a situation where two people could be considered partners in a bor in the public domain, eventually concluding that the case could be where the two people together pry out the last clod of earth that makes the hole deep enough to cause damage. The Gemara rejects the possibility that two people may have instructed a sheli’ah to dig the pit, because, “Ein sheli’ah le-dvar aveirah – no one can appoint a messenger to commit a sinful act.”
According to the Gemara in Massekhet Kiddushin (42b) the underlying principle of ein sheli’ah le-dvar aveirah is based on the fact that the messenger’s true obligation is to follow the directions of God, not of another person, “Divrei ha-rav ve-divrei ha-talmid, divrei me shom’im!”
The Talmud Yerushalmi presents a discussion on this point as to whether the concept of shelihut is true is all cases, and certain situations – like this one – are exceptions, or if we would ordinarily assume that a person cannot pass on responsibilities to another, and we need special teachings in order to permit shelihut to work. This discussion impacts on the question of a sheli’ah le-dvar aveirah since according to the first approach we need to explain why shelihut will not work regarding a forbidden activity; according to the second approach it is obvious that we will not allow the creation of shelihut to do something forbidden.
Tosafot Ri”D argues that the Gemara does not mean to suggest that we would have thought that the messenger could have freed himself from responsibility for performing a forbidden act with the argument that he was only following orders. It is clear to us that an intelligent person must take responsibility for what he does. The discussion on this matter was solely to clarify whether the person who instructed the messenger should also be held accountable, since he was the one who instigated the action.