It is narrated from Sayyiduna Anas (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) used to attack (the enemy) at the time of Fajr prayer and would listen attentively; if he heard the (Fajr) adhan, he would not attack, and if he did not hear the adhan, then he would attack.
Brief Explanation
(Commentary on Ahadith 2479 to 2482)
From this hadith, it is understood that it is not permissible to attack a settlement in which Muslims and non-Muslims reside together.