By 1340, the Muslim presence in Iberia was down to one Muslim kingdom: the Emirate of Granada. This emirate was founded in 1238, after the final Muslim empire to control all of al-Andalus, the Almohad Caliphate (“Caliphate” at this point is being used pretty loosely) lost its hold on Iberia in the Battle of Las Navas de Tolosa in 1212. By that point the Reconquista was in full swing, and when Seville fell to the Castilians in 1248, Granada was the last Muslim polity standing. It managed to hold out for almost 250 more years under the Nasrid Dynasty, though it was a Castilian vassal for most of its existence.
Read the rest at my new home, Foreign Exchanges!