The city—the realm's most important port—had just recently been recovered by the crown after a rebellion by the Banu Ashqilula since 1266 followed by a short occupation by the Marinids of Morocco since 1278. He implemented policies to pacify the population and improved the region's economic condition, as well as embarking on the construction of ships to strengthen the Granadan navy. As governor, he also led Málaga's troops in various campaigns on the Iberian Peninsula, including against rebels and against the Marinid Sultanate.