Mohamed was an Egyptian Army intelligence colonel until 1984. He served with Khalid al-Islambouli, an Islamist terrorist who carried out the assassination of Anwar el-Sadat in 1981. After the assassination Mohamed was discharged on suspicion of fundamentalism. In 1984, Mohamed offered his services to the CIA in Cairo station, which believed he was sent by Egypt as a mole but informed other stations of his interest. He was ultimately transferred to the station dedicated to espionage on Iran in Frankfurt, West Germany, and was stationed to infiltrate a Hezbollah-affiliated mosque in Hamburg. According to Lawrence Wright he "immediately told the Iranian cleric in charge that he was an American spy assigned to infiltrate the community." The mosque had already been penetrated and his announcement was passed on to the CIA, which "terminated Mohamed" and "sent out cables labeling him highly untrustworthy." By this "time, however, Mohamed was already in California on a visa-waiver program that was sponsored by the agency itself, one designed to shield valuable assets or those who have performed important services for the country."