Around 1171, Maimonides was appointed the "Nagid" of the Egyptian Jewish community. Arabist Shelomo Dov Goitein believes the leadership he displayed during the ransoming of the Crusader captives led to this appointment. However he was replaced by Sar Shalom ben Moses in 1173. Over the controversial course of Sar Shalom's appointment, during which Sar Shalom was accused of tax farming, Maimonides excommunicated and fought with him for several years until Maimonides was appointed Nagid in 1195. A work known as "Megillat Zutta" was written by Abraham ben Hillel, who writes a scathing description of Sar Shalom while praising Maimonides as ""the light of east and west and unique master and marvel of the generation"." With the loss of the family funds tied up in David's business venture, Maimonides assumed the vocation of physician, for which he was to become famous. He had trained in medicine in both Córdoba and in Fez. Gaining widespread recognition, he was appointed court physician to the Grand Vizier al-Qadi al Fadil, then to Sultan Saladin, after whose death he remained a physician to the Ayyubid dynasty.