Former judge detained for helping farmers