Shortly after its capture Alexandria again fell into the hands of the Greeks, who took advantage of 'Amr's absence with the greater portion of his army. On hearing what had happened, however, 'Amr returned, and quickly regained possession of the city. About the year 646 'Amr was deprived of his government by the caliph Othman. The Egyptians, by whom 'Amr was greatly beloved, were so much dissatisfied by this act, and even showed such a tendency to revolt, that the Greek emperor determined to make an effort to reduce Alexandria. The attempt proved perfectly successful. The caliph, perceiving his mistake, immediately restored 'Amr, who, on his arrival in Egypt, drove the Greeks within the walls of Alexandria, but was only able to capture the city after a most obstinate resistance by the defenders.