Although the church is referred to in documents from 980, work on it began around 1019, promoted by viscount Bermon, who reformed the community with the institution of a canonical order. In 1040, the new building was consecrated. The life of the community of regular canons headed by an abbot under the patronage of the lords of Cardona continued until 1592, when the establishment
became a college of secular canons.
The subsequent conversion of the castle into a military barracks meant that the canons had progressively to abandon the conventual buildings, until in 1794 they were forced to leave the church, which thereafter was used as a storehouse.
It was declared a National Monument in 1931, and its current appearance is the result of the restoration begun in 1949 by the architect Alexandre Ferrant.
It is a basilica 51 metres long by 23.5 metres wide, with a three-aisled nave, leading on the east into a transept which is not very prominent, with a lantern over the crossing. At the east end there are three apses, the central one of which is preceded by a large presbytery. Its structure is the result of the influence of the Carolingian tradition (evident in the apse, the transept, the lantern and the tribune) combined with early southern Romanesque experimentation (in the treatment of the walls).
The final result is a building that is considered to be prototypical of early Catalan Romanesque.