What the modern world knows as Judaism is largely the result of the efforts of a successive line of Jewish leaders, centered in Baghdad in the midst of the Abbasid dynasty. Throughout the early Middle Ages, these scholars developed the ancient talmudic tradition into a doctrine built to withstand the rigors of the newly arisen Muslim civilization in which they lived. These leaders carried the title of "gaon", a hereditary office that led both schools of Jewish talmudic study, tannaim and amoraim. Traditionally centered in Babylonia, the academies were relocated following the establishment of Abbasid rule - retaining their respective city-names of Sura and Pumbedita - and thereafter flourished as never before. The geonim were the highest authority on religious law and interpretation of the Torah, and were given the power to appoint and dismiss local functionaries like judges, cantors, and kosher slaughterers.
The academies served multiple roles for a dispersed Jewish community. First, they were the center of the academic world for all Jews, receiving scholars from as far afield as Cordoba in Spain and Cochin in South India, twice yearly. Important judicial issues were also brought to the leaders of these academies, for ruling that would be enforced in local Jewish communities by the religious leaders there. Last, the rulings of the geonim and their scholars were considered authoritative interpretation of the Law, and were crucial in keeping Judaism abreast of current situations under Muslim rule. The academies became a general Jewish parliament in their stronger years, and their rulings on issues were respected all over the Diaspora, even in Christian Europe.
The two academies competed with each other, and with a lesser academy and gaon still stationed in Palestine, for donations from Jewish communities, fines for violations that were earmarked for the academies to improve Jewish knowledge of the Law, private donations from influential Jewish families, and the wealth brought by itinerant merchants who visited the geonim with queries. During the Hebrew months of Adar and Elul in the spring and fall respectively, each gaon would call a public assembly of scholars in Baghdad and deliver a lecture on current talmudic learning and the gaon's pronouncement on rabbinic issues. Answers to legal questions from Jews worldwide (known as teshuvot, some of these responses were entire books!) would be assembled and sent out to be circulated among the Jews under the rule of Islam, and eventually to Europe through Italian-Jewish merchants. This constant reiteration of a unified Jewish practice kept a physically dispersed religious community spiritually and doctrinally close, and prevented fragmentation even under the most strenuous pressure from outsiders.
The geonim's tasks were formidable: codification of the Talmud, maintaining the Hebrew language throughout all of Judaism, communicating complex understanding of vague law to those without rabbinic training or readily available research libraries, and most importantly, responding to new and more sophisticated questions that were being asked by Jewish contemporaries of the sophisticated Muslim philosophical schools that were arising as the Abbasids flourished. The geonim not only had to hold together an unruly society of common practitioners, but also had to meet the challenges brought by newly-translated Greek philosophy and the respect it commanded among educated classes, both Muslim and Jewish. The best of the geonim, from Sherira Gaon and Hai Gaon of Pumbedita to the great Saadia Gaon of Sura, combined these two to outshine many of their mediocre successors (of which there were plenty, the position being elaborately hereditary and not elective). It would not be an exaggeration to claim the geonim as the necessary precursors of both Western and Eastern Jewish philosophers in later years, including Moses Maimonides.