The first formal regulation and licensing of medical schools and physicians began during the Middle Ages, notably under rulers like King Roger II of Sicily in 1140 and Emperor Frederick II in 1241. These regulations ensured that practitioners had proper training before treating patients. Prior to this, in the Dark Ages, formal medical education and regulation were virtually nonexistent in Europe.