Why was the whole nation involved in the stoning?

Joshua 7:25 (ESV)

25 And Joshua said, “Why did you bring trouble on us? The LORD brings trouble on you today.” And all Israel stoned him with stones. They burned them with fire and stoned them with stones.

Representatives from the entire nation participated in the punishment of Achan in order to remove the guilt from all the people.1