A little history

As from the 9th century, the land to the south of the Pyrenees became organised into counties that depended on the Frankish kingdom and were part of the “Marca Hispánica” or Hispanic Mark. However, in the 10th century the Catalan counties gradually removed themselves from the Carolingian Empire and eventually achieved political and religious independence.
The Vall de Boí, or Boí Valley, formed part of one of these counties: that of Pallars-Ribagorça, belonging to the house of Toulouse until the end of the 9th century. When the county became independent, there started a complex process of political and religious control over the territory, ending up with the original county being divided into three new independent counties: Ribagorça, Pallars Jussà and Pallars Sobirà, as well as creating a new diocese of the bishopric of Roda. 
The Vall de Boí was in the midst of this process. In the initial division it had remained in the territory of Ribagorça but, as from 1025, it became part of Pallars Jussà and, for a lot of the 11th century, was immersed in the fights between the two Pallars regions. At the same time, in the middle of the 10th century, the churches in the valley which had originally belonged to the bishopric of Urgell, became part of the bishopric of Roda. The creation of this new diocese signalled a period of disputes between both bishoprics. The Vall de Boí was also in the middle of this conflict, as shown by the act of consecration which Ramon Guillem, bishop of Roda-Barbastro, ordered to be painted on a column of the church of Sant Climent in Taüll in 1123, as a symbol of the territory’s control.
A few years later, in 1140, a pact was signed by both bishoprics. Most of the parishes in the Vall de Boí became part of the Urgell bishopric, with only the church of l’Assumpció in Cóll continuing to belong to Roda-Barbastro.
At the same time as this re-structuring of the territory, was happening a new social order was also taking shape: feudalism. Peasants were losing their freedom and becoming tied to the land under the rule of feudal lords, who benefited from the fights between counties and the feudalisation process, increasing their wealth and power.
In the Vall de Boí these lords were the Erill family. From the village of Erillcastell, their place of origin, at the end of the 11th century they started to rise quickly in society, taking place in the campaigns to repopulate and reconquer land under the orders of Alfonso el Batallador (Alfonso the Warrior), King of Aragon.
This was at the start of the 12th century, just before the churches of Sant Climent and Santa Maria in Taüll were consecrated. The lords of Erill used resources obtained from war booties to promote the building of churches in the Vall de Boí, a way of showing their power and of acquiring social prestige.