It's a completely disproportionate decision.
When crossing the neighbor's grass the man may have infiltrated the property of the neighbor, in case that neighbor claims this as an act of invasion.
However, it is unreasonable for a person to be imprisoned for five years for a low-severity offense.
That is why it is very important to have a democratic system of guaranteeing comprehensive defense and to have recourse to other jurisdictions. In case such as these, the decision of the judge can be reversed in another instance.