Castelsardo is a town and comune in the province of Sassari, Sardinia, Italy. It is situated on the north-west coast of the island, about 120 kilometres (75 mi) from Olbia and about 25 kilometres (16 mi) from Alghero.
The town, with a population of about 9,000, is built on a promontory of the Monte Castedddu, the second highest mountain of the Gallura region. The old part of the town is surrounded by walls.
The origins of Castelsardo are disputed. Some scholars believe that the town was founded by the Byzantines in the 9th century, while others think that it was a Genoese colony founded in the 12th century. The Genoese built the castle and the walls.
The town flourished in the late Middle Ages, when it became an important commercial center. After a period of decline, it was ruled by the Spanish from the 16