(א) וְשָׁ֨ם נִקְרָ֜א אִ֣ישׁ בְּלִיַּ֗עַל וּשְׁמ֛וֹ שֶׁ֥בַע בֶּן־בִּכְרִ֖י אִ֣ישׁ יְמִינִ֑י וַיִּתְקַ֣ע בַּשֹּׁפָ֗ר וַ֠יֹּאמֶר אֵֽין־לָ֨נוּ חֵ֜לֶק בְּדָוִ֗ד וְלֹ֤א נַֽחֲלָה־לָ֙נוּ֙ בְּבֶן־יִשַׁ֔י אִ֥ישׁ לְאֹהָלָ֖יו יִשְׂרָאֵֽל׃ (ב) וַיַּ֜עַל כָּל־אִ֤ישׁ יִשְׂרָאֵל֙ מֵאַחֲרֵ֣י דָוִ֔ד אַחֲרֵ֖י שֶׁ֣בַע בֶּן־בִּכְרִ֑י וְאִ֤ישׁ יְהוּדָה֙ דָּבְק֣וּ בְמַלְכָּ֔ם מִן־הַיַּרְדֵּ֖ן וְעַד־יְרוּשָׁלִָֽם׃...(טו) וַיָּבֹ֜אוּ וַיָּצֻ֣רוּ עָלָ֗יו בְּאָבֵ֙לָה֙ בֵּ֣ית הַֽמַּעֲכָ֔ה וַיִּשְׁפְּכ֤וּ סֹֽלְלָה֙ אֶל־הָעִ֔יר וַֽתַּעֲמֹ֖ד בַּחֵ֑ל וְכָל־הָעָם֙ אֲשֶׁ֣ר אֶת־יוֹאָ֔ב מַשְׁחִיתִ֖ם לְהַפִּ֥יל הַחוֹמָֽה׃ (טז) וַתִּקְרָ֛א אִשָּׁ֥ה חֲכָמָ֖ה מִן־הָעִ֑יר שִׁמְע֤וּ שִׁמְעוּ֙ אִמְרוּ־נָ֣א אֶל־יוֹאָ֔ב קְרַ֣ב עַד־הֵ֔נָּה וַאֲדַבְּרָ֖ה אֵלֶֽיךָ׃ (יז) וַיִּקְרַ֣ב אֵלֶ֔יהָ וַתֹּ֧אמֶר הָאִשָּׁ֛ה הַאַתָּ֥ה יוֹאָ֖ב וַיֹּ֣אמֶר אָ֑נִי וַתֹּ֣אמֶר ל֗וֹ שְׁמַע֙ דִּבְרֵ֣י אֲמָתֶ֔ךָ וַיֹּ֖אמֶר שֹׁמֵ֥עַ אָנֹֽכִי׃ (יח) וַתֹּ֖אמֶר לֵאמֹ֑ר דַּבֵּ֨ר יְדַבְּר֤וּ בָרִֽאשֹׁנָה֙ לֵאמֹ֔ר שָׁאֹ֧ל יְשָׁאֲל֛וּ בְּאָבֵ֖ל וְכֵ֥ן הֵתַֽמּוּ׃ (יט) אָנֹכִ֕י שְׁלֻמֵ֖י אֱמוּנֵ֣י יִשְׂרָאֵ֑ל אַתָּ֣ה מְבַקֵּ֗שׁ לְהָמִ֨ית עִ֤יר וְאֵם֙ בְּיִשְׂרָאֵ֔ל לָ֥מָּה תְבַלַּ֖ע נַחֲלַ֥ת ה' (פ) (כ) וַיַּ֥עַן יוֹאָ֖ב וַיֹּאמַ֑ר חָלִ֤ילָה חָלִ֙ילָה֙ לִ֔י אִם־אֲבַלַּ֖ע וְאִם־אַשְׁחִֽית׃ (כא) לֹא־כֵ֣ן הַדָּבָ֗ר כִּ֡י אִישׁ֩ מֵהַ֨ר אֶפְרַ֜יִם שֶׁ֧בַע בֶּן־בִּכְרִ֣י שְׁמ֗וֹ נָשָׂ֤א יָדוֹ֙ בַּמֶּ֣לֶךְ בְּדָוִ֔ד תְּנֽוּ־אֹת֣וֹ לְבַדּ֔וֹ וְאֵלְכָ֖ה מֵעַ֣ל הָעִ֑יר וַתֹּ֤אמֶר הָֽאִשָּׁה֙ אֶל־יוֹאָ֔ב הִנֵּ֥ה רֹאשׁ֛וֹ מֻשְׁלָ֥ךְ אֵלֶ֖יךָ בְּעַ֥ד הַחוֹמָֽה׃ (כב) וַתָּבוֹא֩ הָאִשָּׁ֨ה אֶל־כָּל־הָעָ֜ם בְּחָכְמָתָ֗הּ וַֽיִּכְרְת֞וּ אֶת־רֹ֨אשׁ שֶׁ֤בַע בֶּן־בִּכְרִי֙ וַיַּשְׁלִ֣כוּ אֶל־יוֹאָ֔ב וַיִּתְקַע֙ בַּשּׁוֹפָ֔ר וַיָּפֻ֥צוּ מֵֽעַל־הָעִ֖יר אִ֣ישׁ לְאֹהָלָ֑יו וְיוֹאָ֛ב שָׁ֥ב יְרוּשָׁלִַ֖ם אֶל־הַמֶּֽלֶךְ׃ (ס)
(1) Now there happened to be there a certain base man, whose name was Sheva, the son of Bichri, a Benjamite; and he blew the shofar, and said, ‘We have no portion in David, and we have no inheritance in the son of Jesse; every man to his tents, O Israel.’ (2) So all the men of Israel went up from following David, and followed Sheva the son of Bichri; but the men of Judah clung to their king, from the Jordan to Jerusalem...(15) And they came and besieged him in Abel of Beth-maacah, and they poured a ramp until it stood even with the outer wall; and all the people that were with Yoav battered the wall, to throw it down. (16) A wise woman called out from the city: "Listen! Listen! Please say to Yoav, 'Come close to here so that I may speak to you.’" (17) So he drew close to her; and the woman said: "Are you Yoav?" And he answered, "I am." Then she said to him, "Hear the words of your maidservant." And he replied, "I am listening." (18) Then she spoke, saying, "[Your men] should have spoken at the start saying, 'Let them inquire at Abel [about surrender],' for they would have made peace. (19) I represent the loyal faithful people of Israel. You are seeking to destroy a city in Israel? Why will you swallow up the heritage of the Lord?’ (20) And Yoav answered and said: ‘Far be it, far be it from me, that I should swallow up or destroy. (21) The matter is not so. Rather, a man of the Mount Ephraim, Sheva the son of Bichri by name, has lifted up his hand against the king, against David; deliver him alone, and I will depart from the city.’ And the woman said unto Yoav: ‘Behold, his head shall be thrown to you over the wall.’ (22) Then the woman went unto all the people in her wisdom. And they cut off the head of Sheva the son of Bichri, and threw it out to Yoav. And he blew the shofar, and they were dispersed from the city, every man to his tent. And Yoav returned to Jerusalem unto the king.
תני סיעות בני אדם שהיו מהלכין בדרך פגעו להן גוים ואמרו תנו לנו אחד מכם ונהרוג אותו ואם לאו הרי אנו הורגים את כולכם אפי' כולן נהרגים לא ימסרו נפש אחת מישראל ייחדו להן אחד כגון שבע בן בכרי ימסרו אותו ואל ייהרגו א"ר שמעון בן לקיש והוא שיהא חייב מיתה כשבע בן בכרי ורבי יוחנן אמר אע"פ שאינו חייב מיתה כשבע בן בכרי.
It was taught: If a group of people were traveling and they chanced upon a marauding army which demands of them, "Hand over one of your group, or we will kill all of you," you may not hand anyone over, even though all will end up being killed. If however they specify an individual, you may hand him over, as was the case of Sheva the son of Bichri. Rabbi Shimon ben Laskish says that the case of Sheva the son of Bichri was different since he was liable for the the death penalty. Rabbi Yochanan says that even had he not been liable for the death penalty, [he could have been handed over].
רוצח גופיה מנא לן סברא הוא דההוא דאתא לקמיה דרבה ואמר ליה אמר לי מרי דוראי זיל קטליה לפלניא ואי לא קטלינא לך אמר ליה לקטלוך ולא תיקטול מי יימר דדמא דידך סומק טפי? דילמא דמא דהוא גברא סומק טפי.
...And how do we know this of murder itself [that one must allow himself to be killed instead of killing another]? — It is common sense. Even as one who came before Raba and said to him, 'The governor of my town has ordered me, "Go and kill so and so; if not, I will kill you"'. He [Raba] answered him, 'Let him rather kill you than that you should commit murder; who says that your blood is redder? Perhaps his blood is redder.'
Summary of groups being attacked:
Case 1: Attacker demands any person. Law: Don't hand anyone over, because "who says that your blood is redder?"
Case 2: Attacker demands a specific person. Law: Rabbi Yochanan - if he was selected, you can hand him over; Rabbi Shimon ben Lakish - Don't hand him over, unless he was selected AND he happened to be liable for the death penalty, like Sheva ben Bichri
Chazon Ish (Rabbi Avraham Yeshaya Karelitz, 1878 - 1953, lived in Bnei Brak, Israel) on Sanhedrin #25
Imagine a case where an arrow or missile was launched towards many people and a person had the power to divert the arrow or missile so that it only killed one person rather than many. It is possible to argue that this case is not similar to giving over one person to a group of idol worshipers to be killed because in that case (the act of giving up the one person) is an act of achzarit (cruelty)...In our case, it is an act of haztalah (saving life) since one's intention is to save many...and only by chance, indirectly, will the one person die (because you diverted to arrow or missile).