The counts of Toulouse extended their domain to the Mediterranean coast, but their rule was short-lived. During the 10th century civilization, the arts and education had declined; a rebirth of culture and order during the reign of Charlemagne was smothered by Viking invasions, augmented by poor weather and plagues which contributed to population loss. Large areas of western Europe returned to wilderness, and cities were depopulated. Churches were abandoned or plundered; Christianity lost much of its moral authority, although Roman culture survived in scattered monasteries. This contrasted with the flourishing emirate of Córdoba in Spain and the Byzantine Empire. Authority decentralized, falling from counts to viscounts to thousands of local feudal lords. By the end of the century, France was governed by thousands of local rulers who controlled one town or one castle and a few surrounding villages. Between 900 and 980 the counts of Toulouse gradually lost control to local dynastic rulers, and by 1000 ruled only a few scattered estates; the city was ruled by a viscount, independent of the counts.