In medieval times, church schools were established in the Holy Roman Empire to educate the future members of the clergy, as stipulated by the 1215 Fourth Council of the Lateran, later adopted by the sunday schools of the Protestant Reformation. First secular schools followed during the pietism movement from the late 17th century onwards and were further promoted by the advocates of the Enlightenment. In 1717 King Frederick William I of Prussia decreed the compulsory education of children from the age of five to twelve.