Rambam codifies the laws of kiddush Hashem and chillul Hashem, ruling when one must surrender life rather than transgress. This is the legal framework within which the martyrdom of the Crusade victims was debated and understood by later authorities.
וְכָל הַדְּבָרִים הָאֵלּוּ שֶׁלֹּא בִּשְׁעַת הַגְּזֵרָה אֲבָל בִּשְׁעַת הַגְּזֵרָה וְהוּא שֶׁיַּעֲמֹד מֶלֶךְ רָשָׁע כִּנְבוּכַדְנֶצַּר וַחֲבֵרָיו וְיִגְזֹר גְּזֵרָה עַל יִשְׂרָאֵל לְבַטֵּל דָּתָם אוֹ מִצְוָה מִן הַמִּצְוֹת. יֵהָרֵג וְאַל יַעֲבֹר אֲפִלּוּ עַל אַחַת מִשְּׁאָר מִצְוֹת בֵּין נֶאֱנָס בְּתוֹךְ עֲשָׂרָה בֵּין נֶאֱנָס בֵּינוֹ לְבֵין עוֹבְדֵי כּוֹכָבִים: כָּל מִי שֶׁנֶּאֱמַר בּוֹ יַעֲבֹר וְאַל יֵהָרֵג וְנֶהֱרַג וְלֹא עָבַר הֲרֵי זֶה מִתְחַיֵּב בְּנַפְשׁוֹ. וְכָל מִי שֶׁנֶּאֱמַר בּוֹ יֵהָרֵג וְאַל יַעֲבֹר וְנֶהֱרַג וְלֹא עָבַר הֲרֵי זֶה קִדֵּשׁ אֶת הַשֵּׁם. וְאִם הָיָה בַּעֲשָׂרָה מִיִּשְׂרָאֵל הֲרֵי זֶה קִדֵּשׁ אֶת הַשֵּׁם בָּרַבִּים כְּדָנִיֵּאל חֲנַנְיָה מִישָׁאֵל וַעֲזַרְיָה וְרַבִּי עֲקִיבָא וַחֲבֵרָיו. וְאֵלּוּ הֵן הֲרוּגֵי מַלְכוּת שֶׁאֵין מַעֲלָה עַל מַעֲלָתָן. וַעֲלֵיהֶן נֶאֱמַר (תהילים מד כג) "כִּי עָלֶיךָ הֹרַגְנוּ כָל הַיּוֹם נֶחְשַׁבְנוּ כְּצֹאן טִבְחָה". וַעֲלֵיהֶם נֶאֱמַר (תהילים נ ה) "אִסְפוּ לִי חֲסִידָי כֹּרְתֵי בְרִיתִי עֲלֵי זָבַח". וְכָל מִי שֶׁנֶּאֱמַר בּוֹ יֵהָרֵג וְאַל יַעֲבֹר וְעָבַר וְלֹא נֶהֱרַג הֲרֵי זֶה מְחַלֵּל אֶת הַשֵּׁם. וְאִם הָיָה בַּעֲשָׂרָה מִיִּשְׂרָאֵל הֲרֵי זֶה חִלֵּל אֶת הַשֵּׁם בָּרַבִּים וּבִטֵּל מִצְוַת עֲשֵׂה שֶׁהִיא קִדּוּשׁ הַשֵּׁם וְעָבַר עַל מִצְוַת לֹא תַעֲשֶׂה שֶׁהִיא חִלּוּל הַשֵּׁם. וְאַף עַל פִּי כֵן מִפְּנֵי שֶׁעָבַר בְּאֹנֶס אֵין מַלְקִין אוֹתוֹ וְאֵין צָרִיךְ לוֹמַר שֶׁאֵין מְמִיתִין אוֹתוֹ בֵּית דִּין אֲפִלּוּ הָרַג בְּאֹנֶס. שֶׁאֵין מַלְקִין וּמְמִיתִין אֶלָּא לְעוֹבֵר בִּרְצוֹנוֹ וּבְעֵדִים וְהַתְרָאָה שֶׁנֶּאֱמַר בְּנוֹתֵן מִזַּרְעוֹ לַמּלֶךְ (ויקרא כ ה) "(וְנָתַתִּי) [וְשַׂמְתִּי] אֲנִי אֶת פָּנַי בָּאִישׁ הַהוּא". מִפִּי הַשְּׁמוּעָה לָמְדוּ הַהוּא לֹא אָנוּס וְלֹא שׁוֹגֵג וְלֹא מֻטְעֶה. וּמָה אִם עֲבוֹדַת כּוֹכָבִים שֶׁהִיא חֲמוּרָה מִן הַכּל הָעוֹבֵד אוֹתָהּ בְּאֹנֶס אֵינוֹ חַיָּב כָּרֵת וְאֵין צָרִיךְ לוֹמַר מִיתַת בֵּית דִּין. קַל וָחֹמֶר לִשְׁאָר מִצְוֹת הָאֲמוּרוֹת בַּתּוֹרָה. וּבַעֲרָיוֹת הוּא אוֹמֵר (דברים כב כו) "וְלַנַּעֲרָה לֹא תַעֲשֶׂה דָבָר". אֲבָל אִם יָכוֹל לְמַלֵּט נַפְשׁוֹ וְלִבְרֹחַ מִתַּחַת יַד הַמֶּלֶךְ הָרָשָׁע וְאֵינוֹ עוֹשֶׂה הִנֵּה הוּא כְּכֶלֶב שָׁב עַל קֵאוֹ. וְהוּא נִקְרָא עוֹבֵד עֲבוֹדַת כּוֹכָבִים בְּמֵזִיד וְהוּא נִטְרָד מִן הָעוֹלָם הַבָּא וְיוֹרֵד לַמַּדְרֵגָה הַתַּחְתּוֹנָה שֶׁל גֵּיהִנֹּם:
All the above [distinctions] apply [only in times] other than times of a decree. However, in times of a decree - i.e., when a wicked king like Nebuchadnezzar or his like will arise and issue a decree against the Jews to nullify their faith or one of the mitzvot - one should sacrifice one's life rather than transgress any of the other mitzvot, whether one is compelled [to transgress] amidst ten [Jews] or one is compelled [to transgress merely] amidst gentiles. If anyone about whom it is said: "Transgress and do not sacrifice your life," sacrifices his life and does not transgress, he is held accountable for his life. When anyone about whom it is said: "Sacrifice your life and do not transgress," sacrifices his life and does not transgress, he sanctifies [God's] name. If he does so in the presence of ten Jews, he sanctifies [God's] name in public, like Daniel, Chananiah, Mishael, Azariah, and Rabbi Akiva and his colleagues. These are those slain by [the wicked] kingdom, above whom there is no higher level. Concerning them, [Psalms 44:23] states: "For Your sake, we have been slain all day, we are viewed as sheep for the slaughter," and [Psalms 50:5] states: "Gather unto Me, My pious ones, those who have made a covenant with Me by slaughter." When anyone about whom it is said: "Sacrifice your life and do not transgress," transgresses instead of sacrificing his life, he desecrates [God's] name. If he does so in the presence of ten Jews, he desecrates [God's] name in public, nullifies [the fulfillment of] the positive commandment of the sanctification of [God's] name, and violates the negative commandment against the desecration of God's name. Nevertheless, since he was forced to transgress, he is not [punished by] lashing, and, needless to say, is not executed by the court even if he was forced to slay [a person]. The [punishments of] lashes and execution are administered only to one who transgresses voluntarily, [when the transgression is observed by] witnesses, and [when] a warning [was given], as [Leviticus 20:5] states concerning one who gives his children to [the worship of] Molech: "I will turn My face against that person." The oral tradition teaches [that we can infer]: "that person" and not one who is forced [to transgress, who transgresses] inadvertently, or [who transgresses] because of an error. If, concerning the worship of false gods, which is the most serious [of sins], a person who is forced to worship is not liable for karet, nor, needless to say, execution by a court, how much more so [does this principle apply] regarding the other mitzvot of the Torah? [Similarly,] regarding forbidden sexual relations, [Deuteronomy 22:26] states: "Do not do anything to the maiden." One who could, however, escape and flee from under the power of a wicked king and fails to do so is like a dog who returns [to lick] his vomit. He is considered as one who worships false gods willingly. He will be prevented from reaching the world to come and will descend to the lowest levels of Gehinnom.