If I recall, there wasn't much of a reason behind it. In hindsight, it was a bad play since there was some suspicion of you, but it turned out to be a good play because you were the cop.
The idea situation would be to have let the town lynch you the next day.