Medieval Amalfi was ruled, in the tenth and eleventh centuries, by a series of dukes (Latin: duces), sometimes called dogi (singular doge) corresponding with the republic of Venice, a maritime rival throughout the Middle Ages. Before the dukedom was formally established in 957, various patricians governed the territory. Amalfi established itself as one of the earliest maritime trading powers renowned throughout the Mediterranean, competing with northern European cities.
The Duke of Amalfi was reestablished as a Spanish ducal title in 1639 by King Philip IV for Prince Ottavio Piccolomini, a Holy Roman Imperial Army Field Marshal.
Of noble Tuscan descent, two Popes were scions of the Piccolomini family, and the 1st duke's younger brother Dom. Ascanio served as Archbishop of Siena from 1628 until 1671.
King Alfonso XIII revived the dukedom in 1902.
The prefecture's establishment is not certain, but the first elected Prefect of Amalfi was in 839.
The time of the patricians (or judges) is not well known. The numbering of the rulers of Amalfi usually begins again with the judgeship. Mastalus was elected judge upon his succession in 914.