In the 12th century, during the controversies between Frederick Barbarossa and the Papacy, Recanati expelled the feudal counts which ruled its area, and gave itself a communal constitution under the lead of consuls (consoli). In 1203 they were replaced by podestà. In 1228, Recanati sided with Barbarossa's nephew, Frederick II, who again was in conflict with the popes; for this aid, the town was given the control of the nearby Adriatic shore, and the right to found a port (the modern Porto Recanati).