Many Jewish residents had no reason to feel kindly toward the former masters of Egypt. In 629 the Emperor Heraclius I had driven the Jewish population from Jerusalem, and this was followed by massacres of Jewish residents throughout the empire—in Egypt, often aided by the Coptic population, who may have been trying to settle old grievances against Jewish groups, dating from the Persian conquest of Amida at the time of Emperor Anastasius I (502) and of Alexandria by the Persian general Shahin Vahmanzadegan (617), when some of the Jewish residents sided with the conquerors. The "Treaty of Alexandria" (November 8, 641), which sealed the Arab conquest of Egypt, expressly stipulated that the Jewish residents were to be allowed to remain in that city unmolested; and at the time of the capture of that city, 'Amr ibn al-'As, in his letter to the caliph, relates that he found there 40,000 Jews.