כֹּהֵן קוֹדֵם לְלֵוִי, לֵוִי לְיִשְׂרָאֵל, יִשְׂרָאֵל לְמַמְזֵר, וּמַמְזֵר לְנָתִין, וְנָתִין לְגֵר, וְגֵר לְעֶבֶד מְשֻׁחְרָר. אֵימָתַי, בִּזְמַן שֶׁכֻּלָּן שָׁוִין. אֲבָל אִם הָיָה מַמְזֵר תַּלְמִיד חָכָם וְכֹהֵן גָּדוֹל עַם הָאָרֶץ, מַמְזֵר תַּלְמִיד חָכָם קוֹדֵם לְכֹהֵן גָּדוֹל עַם הָאָרֶץ:
Un cohen passe avant le lévite, celui-ci passe avant d’autres Israélites; ceux-ci passent avant un bâtard. Le bâtard passe avant le nathin, celui-ci passe avant l’étranger prosélyte, lequel passe avant l’esclave affranchi. Toutes ces préférences se rapportent aux hommes qui ne se distinguent entre eux par aucune autre chose. Mais si le bâtard est un savant, et si le grand prêtre est un ignorant, le savant bâtard passe avant le grand prêtre ignorant.
Mishneh Torah, Gifts to the Poor
If we have before us many poor people or many captives, and there is not enough in the fund to sustain them, or to clothe them, or to redeem them all, a priest takes precedence over a Levite, a Levite over a [regular] Jew, a Jew over a chalel [an illegitimate child of a priest], a chalel over a shetuki [an illegitimate child with an unknown father], a shetuki over a asufi [a foundling], an asufi over a mamzer [a child who was conceived in a union forbidden by the Torah], a mamzer over a natin [a descendent of the Gibeonites], and a natin over a stranger, so long as the natin was praised with us in holiness, and a convert takes precedence over a freed slave, for he [the slave] was once one of the cursed.161See Mishnah Horayot 3:8.
Mishneh Torah, Gifts to the Poor
To what does this refer? When both who are imprisoned are equal in wisdom. But if there was a High Priest who was an ignoramus and a mamzer who was a wise disciple, the wise disciple takes precedence. Anyone who is great in wisdom takes precedence over another. But if one of them [the captives] was one's rabbi or father, even if there is someone who is greater in wisdom, one's rabbi or father [takes precedence]. Even if there is someone there [among the captives] who is greater in wisdom than his rabbi or his father, so long as he [his father or rabbi] is a wise disciple, he [the father or the rabbi] takes precedence over the one who is greater than them in wisdom.162See Mishnah Horayot 3:8 and Babylonian Talmud Horayot 13a.