In the time of the Caliphate of Córdoba in the 10th century, the northern border stabilized against the Frankish-ruled counties along the Llobregat and Cardener rivers and the Montsec Range. Lleida and Tortosa, the two main cities of the Muslim ruled area of today's Catalonia (historiographically known as "New Catalonia"), formed the centers of defense. Many of the predominantly Christian inhabitants of these Muslim border regions converted to Islam. Especially the inhabitants of the valleys of Ebro, Segre, and Cinca as well as the plain of Lleida took over the way of life and achievements of the Muslims like the highly developed irrigation techniques. The most important Muslim cities in Catalonia were Lleida, Balaguer and Tortosa. They developed an old town (Medina) in North African style with mosque, administrative headquarters and court. They also had large markets (Suq) with workshops and homes of artisans. In some cities there were open places of worship (Musallā) and – as in Tortosa – including a military fortress. Goods were exported via the port of Tortosa. Although there were peace treaties between the caliph in Córdoba and some Catalan counts, the mutual attacks accumulated so, in 985 Almanzor, de facto ruler of the Caliphate, sacked Barcelona and captured thousands of its inhabitants.