Sa'sa'ah says: I said to Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both): We come to a village in the Sawad and ask for the door to be opened; if it is not opened for us, we break the door, take out a sheep and slaughter it. He said: Why do you do that? I said: We consider it lawful for us. The narrator says: He recited this verse: "That is because they said: 'The unlettered have no claim against us,' and they tell a lie against Allah while they know." [Surah Al Imran: 75]
If this concerns the mu'ahadin (people under treaty), it is because they had not made peace with them on (the condition of) hospitality, so it was not lawful for them to take it; and Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجزية / 18699