Even in antiquity, attempts were made to increase the quality of wine through appropriate laws and regulations and to prevent abuse. There are numerous written records of this (see under Literature). The oldest wine law comes from the Babylonian ruler Hammurabi (1728-1686 BC), whose empire at that time encompassed almost all of Mesopotamia. The law of the Roman Republic also regulated the sale (especially wholesale) of wine and defined in the individual laws what quality guarantee the buyer could expect and how the wine could be marketed. In the individual countries, quality criteria and classes were already introduced in the early Middle Ages. Emperor Charlemagne (742-814) enacted corresponding laws.