The legal basis for such restrictions must be clearly defined by law and the deprivation of the right to vote and to be elected, as a result of mental incapacity, may only be imposed by a decision of a court of law.