From the 1040s to 1130, the country was at peace.  In 1130, the civil war era broke out on the basis of unclear succession laws, which allowed all the king's sons to rule jointly. For periods there could be peace, before a lesser son allied himself with a chieftain and started a new conflict. The Archdiocese of Nidaros was created in 1152 and attempted to control the appointment of kings. The church inevitably had to take sides in the conflicts, with the civil wars also becoming an issue regarding the church's influence of the king. The wars ended in 1217 with the appointment of Håkon Håkonsson, who introduced clear law of succession.