When was the treatise that allowed a congregation to elect or remove a minister?
In the Middle Ages, the Church and the worldly authorities were closely related. Martin Luther separated the religious and the worldly realms in principle (doctrine of the two kingdoms). The believers were obliged to use reason to govern the worldly sphere in an orderly and peaceful way. Luther's doctrine of the priesthood of all believers upgraded the role of laymen in the church considerably. The members of a congregation had the right to elect a minister and, if necessary, to vote for his dismissal (Treatise On the right and authority of a Christian assembly or congregation to judge all doctrines and to call, install and dismiss teachers, as testified in Scripture; 1523). Calvin strengthened this basically democratic approach by including elected laymen (church elders, presbyters) in his representative church government. The Huguenots added regional synods and a national synod, whose members were elected by the congregations, to Calvin's system of church self-government. This system was taken over by the other reformed churches.