He abandoned the defensive stance adopted by his predecessors and took up the fight actively against the Moorish states to the south. Battles were fought at Lleida and Tarragona. At the same time he managed to retain diplomatic relations with Córdoba, which had increasingly lost control of its northern provinces. In 912, Muhammad al-Tawil, the Wāli of Huesca and Lleida, attacked and destroyed the Barcelonian army under Sunyer in the Tàrrega valley. However Sunyer's counterattack in 914 successfully pushed them back and resulted in the death of al-Tawil. He subsequently repopulated the county of Penedès, which had been the scene of many conflicts between the Frankish and Muslim empires, as far as Olèrdola (929).