At the end of the 9th century, the counties of the March and Septimania were governed by Hispano-Gothic families. In 870, Guifré el Pelós, from the House of Carcassonne, was made Count of Urgell and Cerdanya, and in 878 the Count of Girona and Barcelona. He organised the repopulation of the county of Osona, El Berguedà and part of Bages, and founded the monasteries of Ripoll and of Sant Joan de les Abadesses. His sons were the first counts not be named by the Frankish kings and so began a county dynasty. Guifré Borrell inherited the main area of Barcelona, Girona and Osona; Miró II inherited La Cerdanya, El Berguedà and El Conflent; while Sunifred took L'Urgell.