The failure of the county of Cerdanya to establish lasting supremacy over Catalonia lies in the penchant of its counts to divide their patrimony between all of their sons — and the rights of inheritance of brothers — and the gathering strength of the nobility following the decline of Cerdanya's military importance. In 1058, when Count Raymond accepted the pay of Raymond Berengar I of Barcelona to be his ally in the fight against the Moors, the fate of Cerdanya to be in the control of Barcelona was sealed. In the next centuries, Cerdanya was part of the Principality of Catalonia.