In 1045, the “heterodox sects in the city were severely persecuted, and the Jews, with the rest, suffered greatly"; see History of Tunisia, History of the Jews in Tunisia. As a result, the city's Jewish residents fled; Alfasi moved to Fes with his wife and two children. Fes' Jewish community undertook to support him and his family so that he could work on his Sefer Ha-halachot undisturbed. They also founded a yeshiva in his honor, and many students throughout Morocco came to study under his guidance. The most famous of his many students is Rabbi Judah Halevi, author of the Kuzari; he also taught Rabbi Joseph ibn Migash (the Ri Migash), who was in turn a teacher of Rabbi Maimon, father and teacher of Maimonides (Rambam). Alfasi remained in Fes for 40 years, during which time he completed his Sefer Ha-halachot. Eventually, he became known as Alfasi ("from Fes"); Rif is an acronym of Rabbi Isaac alFasi. In 1088, when an old man of seventy-five, two informers denounced him to the government upon some unknown charge. He left Fes for Spain, eventually becoming head of the yeshiva in Lucena in 1089.
In a sense, Alfasi brought the geonic period to a close - the last of the Babylonian geonim, Rav Hai Gaon, died when Alfasi was 25 years old; Alfasi himself was called Gaon by several early halachic authorities . His "magnanimous character" is illustrated by two incidents. When his opponent Rabbeinu Isaac Albalia died, Alfasi adopted Albalia's son. When Alfasi was himself on the point of death, he recommended as his successor in the Lucena rabbinate, not his own son, but his pupil Rabbi Joseph ibn Migash.
Sefer ha-Halachot plays a fundamental role in the development of Halakha. Firstly, "the Rif" succeeded in producing a Digest, which became the object of close study, and led in its turn to the great Codes of Maimonides and of Rabbi Joseph Karo. Secondly, it served as one of the "Three Pillars of Halakha", as an authority underpinning both the Arba'ah Turim and the Shulkhan Arukh. Rabbi Nissim of Gerona (the RaN) compiled a detailed and explicit commentary on this work; In yeshivot "the Rif and the RaN" are regularly studied as part of the daily Talmudic schedule.
This work was published prior to the times of Rashi and other commentaries, and resulted in a profound change in the study practices of the scholarly Jewish public in that it opened the world of the gemara to the public at large. It soon became known as the Talmud Katan ("Little Talmud"). At the close of the Middle Ages, when the Talmud was banned in Italy, Alfasi's code was exempted so that from the 16th to the 19th centuries his work was the primary subject of study of the Italian Jewish community. Alfasi also occupies an important place in the development of the Sephardi method of studying the Talmud. In contradistinction to the Ashkenazi approach, the Sephardim sought to simplify the Talmud and free it from casuistical detail; see for e.g. Chananel Ben Chushiel.