Self-Defense in the Dark
(א) אִם־בַּמַּחְתֶּ֛רֶת יִמָּצֵ֥א הַגַּנָּ֖ב וְהֻכָּ֣ה וָמֵ֑ת אֵ֥ין ל֖וֹ דָּמִֽים׃ (ב) אִם־זָרְחָ֥ה הַשֶּׁ֛מֶשׁ עָלָ֖יו דָּמִ֣ים ל֑וֹ שַׁלֵּ֣ם יְשַׁלֵּ֔ם אִם־אֵ֣ין ל֔וֹ וְנִמְכַּ֖ר בִּגְנֵבָתֽוֹ׃
(1) If the thief is seized while tunneling, and he is beaten to death, there is no bloodguilt in his case. (2) If the sun has risen on him, there is bloodguilt in that case.—He must make restitution; if he lacks the means, he shall be sold for his theft.

JPS Torah Commentary (Jeffrey Tigay): Because the burglar is likely to encounter the occupants and must anticipate that they will use force, his nocturnal timing creates a presumption of homicidal intent. The condition of imminent threat, necessary to satisfy lawful self-defense by the householder, is thus fulfilled. Hence, no bloodguilt is incurred should the intruder be killed...

If the break-in occurred in broad daylight, however, it is not presumed to present imminent danger to life; the use of deadly force is therefore deemed to be unwarranted, and bloodguilt would ensue. Here the issue is the hierarchy of values. The biblical scale gives priority to the protection of life - even the life of the burglar - over the protection of property.

מתני׳ הבא במחתרת נידון על שם סופו

MISHNA: A burglar who is found breaking into a house may be killed by the owner of the house with impunity (see Exodus 22:1). He too is sentenced on account of his ultimate end, as it is presumed that if the owner of the house would resist the burglar, the burglar would kill the owner of the house.

(ד) צָרוֹר אֶת הַמִּדְיָנִים, לָמָּה (במדבר כה, יח): כִּי צֹרְרִים הֵם לָכֶם, מִכָּן אָמְרוּ חֲכָמִים בָּא לְהָרְגֶּךָ הַשְׁכֵּם לְהָרְגוֹ.

(4) 4 (Numb. 25:17) “Harass the Midianites”: Why? (As in Numb. 25:18,) “Because they are harassing you.” Hence the sages have said, “If someone comes to kill you, act first to kill him.”Ber. 62b; Sanh. 72a.

ת"ר (שמות כב, א) אין לו דמים אם זרחה השמש עליו וכי השמש עליו בלבד זרחה אלא אם ברור לך הדבר כשמש שאין לו שלום עמך הרגהו ואם לאו אל תהרגהו תניא אידך אם זרחה השמש עליו דמים לו וכי השמש עליו בלבד זרחה אלא אם ברור לך כשמש שיש לו שלום עמך אל תהרגהו ואם לאו הרגהו קשיא סתמא אסתמא

§ Apropos a burglar who breaks into a house, the Sages taught in a baraita: The verses state: “If a burglar is found breaking in, and is smitten and dies, there shall not be blood shed on his account. If the sun is risen upon him, there shall be blood shed on his account” (Exodus 22:1–2). A question may be raised: But did the sun rise only upon him? Rather, these words must be understood in a metaphoric sense: If the matter is as clear to you as the sun that the burglar is not coming to you in peace, but rather his intention is to kill you, arise and kill him first. But if you are not sure about his intentions, do not kill him.

It is taught in another baraita: The verse states: “If the sun is risen upon him, there shall be blood shed on his account.” A question may be raised: But did the sun rise only upon him? Rather, these words must be understood as follows: If the matter is as clear to you as the sun that the burglar is coming to you in peace, do not kill him. But if you are not sure about his intentions, arise and kill him. The Gemara notes a difficulty: The halakha in the undetermined case as stated in the first baraita contradicts the halakha in the undetermined case as stated in the second baraita. The first baraita indicates that if the homeowner is unsure about the burglar’s intentions, he is prohibited from killing the burglar, whereas the second baraita indicates that in such a case, he is permitted to kill the burglar.