Bava Kama6: 1
הַכּוֹנֵס צֹאן לְדִּיר וְנָעַל בְּפָנֶיהָ כָרָאוּי, וְיָצְאָה וְהִזִּיקָה, פָּטוּר. לֹא נָעַל בְּפָנֶיהָ כָרָאוּי, וְיָצְאָה וְהִזִּיקָה, חַיָּב.  נִפְרְצָה בַלַּיְלָה, אוֹ שֶׁפְּרָצוּהָ לִסְטִים, וְיָצְאָה וְהִזִּיקָה, פָּטוּר. הוֹצִיאוּהָ לִסְטִים, לִסְטִים חַיָּבִים.
[If] one brings a sheep into a fold and locks [the door] before it properly, but it gets out and damages, he is exempt. [If] he does not lock [the door] before it properly, and it gets out and damages, he is liable.  [If] it breaks at night, or if robbers break it, and it goes out and damages, he is exempt. Should robbers take it out, the robbers are liable.