Muhammad II died in 1302 and was succeeded by his son Muhammad III, Abu Said's brother-in law.[10] According to near-contemporary historian Ibn Khaldun, Abu Said had the complete trust of the Sultan, who kept him as governor of Málaga throughout his reign.[12] Abu Said was responsible for the 1306 conquest of Ceuta, on the North African shore, in the name of Muhammad III.[10] Partly by the instigation of Abu Said's agents, the city had rebelled against their Marinid overlords in 1304 and was henceforth ruled by the Banu al-Azafi, a local noble family.[16] However, on 12 May 1306 a Granadan fleet led by Abu Said arrived, was welcomed by local supporters and took over the city without a fight.[17] The conquest of Ceuta gave Granada strategic control over both sides of the Straits of Gibraltar, but so alienated its neighbours that soon the Marinids, Aragon and Castile—its three larger neighbours—formed an alliance against Granada.[18]