Allah, the Blessed and Exalted, says: "It is not permissible for a believer to kill a believer except by mistake. Whoever kills a believer by mistake must free a believing slave and pay blood money to the heirs of the slain, unless they forgo it. If the slain person belonged to a people hostile to you and he himself was a believer, then a believing slave must be freed. And if he belonged to a people with whom you have a treaty, then blood money must be paid to his heirs and a believing slave freed." [Surah al-Nisa: 92]
Imam al-Shafi'i (may Allah have mercy on him) said: The meaning of "from a people hostile to you" [Surah al-Nisa: 92] is: among a people hostile to you.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب القسامة / 16469