It is narrated from Hizam bin Sa'd bin Muhayṣah, may Allah be pleased with him, that the she-camel of Sayyiduna Bara' bin 'Azib, may Allah be pleased with him, entered a garden and caused damage to it. So the Messenger of Allah, peace and blessings be upon him, gave the ruling that the owners are responsible for protecting their garden during the day, and if animals cause damage at night, then the liability will be upon the owner of the animal.
Hadith Referenceالسنن المأثورة / باب ما جاء في فدية الأذى / 499
Hadith Takhrijمسند احمد: 97/39، رقم: 23691 وقال الارنوؤط: اسناده مرسل صحيح، السنن الكبرى للبيهقى: 341/8، مؤطا امام مالك، الأقضية، باب القضاء في الضواري والحربة رقم: 37، ووصله ابو داؤد الاجارة باب المواشى تفسد زرع قوم، رقم: 3570 وقال الالباني: صحيح