The Hanbali book Mataalib Awla al-Nahy (The demands of the primary prohibitions) states: The imam must preserve the dhimmis, prevent what harms them, free their captives, and repel those who seek to harm them in so long as they do not reside in the Dar al-Hard, but are alone in our territories. This is because they are treated with the laws of Islam and as their contract is valid then such is necessary as it is for Muslims. (Mataalib Awla al-Nahy sharh Ghayat al-Muntaha of Mustafa al-Suyuti al-Rahibaani).