Maimonides was born in April 1135 C.E. in Córdoba, a city which, like most of the Iberian peninsula at that time, was under Muslim rule. A few years later, Spain was invaded by a fundamentalist Muslim sect that had already seized power in Northwest Africa. This sect, the Almohads (Al-Muwalidun: those who assert the unity of God), adopted a policy of forced conversion to Islam. Many Jews were coerced into making a public affirmation that Muhammad was the prophet of God; others refused and suffered martyrdom. In order to survive, Maimonides' family wandered from place to place, reaching Fez in 1160 and going from there in 1165 to the Land of Israel and to Egypt, where they could again practice their faith openly.
One of the forced converts inquired of a rabbi--a distinguished talmudist--whether he would gain merit by observing secretly as many commandments of Judaism as he could. The rabbi gave a halakhic ruling that any Jew who had made a profession of Islam would thereafter commit an additional sin with each commandment of Judaism that he performed. Horrified by this ruling, Maimonides composed his Epistle on Martyrdom to refute it and to offer sounder advice to the forced converts. The epistle was probably written in 1165, shortly before Maimonides and his family left Fez.