Buraidah reported: When the Messenger of Allaah (peace and blessings be upon him) would appoint a commander over the army, he would personally enjoin him to fear Allaah and to be good with the Muslims who were with him.
Then the Prophet (peace and blessings be upon him) would say,
“Go forth in the name of Allaah and fight whoever disbelieves in Allaah. Fight and do not steal, do not be treacherous, do not mutilate, and do not kill children. When you meet your enemy among the idolaters, then call them to three options. If they respond to any of them, then restrain your hands from fighting them.
First, call them to Islaam. If they respond to you, then accept it from them and restrain your hands from fighting them. Then, invite them to migrate from their lands to the land of the emigrants, and if they do so they will have the rights and duties of the emigrants; but if they refuse to migrate, then they will have the status of the desert Arabs. They will be subject to the ruling of Allaah just as the believers, but they will receive no share of the spoils unless they struggle alongside the Muslims.
Second, if they refuse to accept Islaam, then ask them to pay tribute. If they agree to pay tribute, then accept it from them and restrain your hands from fighting them.
Third, if they refuse to pay tribute, then seek help from Allaah and fight them. When you besiege the people of a fortress and they appeal to you for protection in the name of Allaah and His Prophet, do not give them protection in the name of Allaah and His Prophet, but rather give them protection in the name of you and your companions, for verily, for you to violate the protection of yourself and your companions is a lesser sin than to violate the protection of Allaah and his Messenger; and when you besiege the people of a fortress and they appeal for you to bring them out according to the rule of Allaah, do not bring them our according to the rule of Allaah, but rather bring them out according to your ruling, for verily, you do not know if you will judge with the ruling of Allaah concerning them or not.”
[Saheeh Muslim (1731)]