In Roman times, an important settlement developed along the road linking Asti and Alba, on the "Fundus Mallianus". In the 10th and 11th centuries, more people settled at the top of the hill under the protection of the castle, which has been documented to 996. In the Middle Ages, it belonged to the commune of Asti, and served a defensive purpose. The castle and its village were enfeoffed in 1240 to Asti's noble Alfieri family.
Later the feud was split up and divided between the various members of the family. In the early years of the 15th century, the family's power declined; a part of the feud was given to the Damiano family and the rest to the Roero, Malabayla and Parato di Castellinaldo families. Despite this, the Alfieris continued to maintain their supremacy over the territory.
In the 17th century, the Savoys ruled the area. Count Catalano Alfieri, a general in the Savoy infantry, had a luxurious residence constructed on the site of the medieval fortress. It was an imposing building with austere lines, made graceful by the mature Piedmontese baroque style. With the extinction of that branch of the family, in 1797, the castle was inherited by the Alfieri di Sostegno family, the lords of San Martino.
According to legend, it was in this castle that Vittorio Alfieri, observing a painting of Cleopatra being bitten by an asp, had the inspiration for his tragedy Saul.
Today the castle belongs to the town. In the east wing of the main floor is the museum of folk arts and traditions, a collection of elements of Piedmontese culture with an unusual section dedicated to plaster ceilings.