during this period the kingdom was threatened by the mamluk sultanate and the mongols