Ibn Ka'b bin Malik narrates from his uncle (may Allah be pleased with him) that when the Prophet (peace and blessings be upon him) dispatched them to Ibn Abi al-Huqayq, he forbade the killing of women and children.
(b) Imam al-Shafi'i (may Allah have mercy on him) said: Sufyan held that the saying of the Prophet (peace and blessings be upon him), "They are from among them," means that killing them is permissible, and that the hadith of Ibn Abi al-Huqayq abrogates it. He said: When al-Zuhri narrated the hadith of al-Sa'b bin Jaththamah (may Allah be pleased with him), he would follow it with the hadith of Ibn Ka'b bin Malik.
Imam al-Shafi'i (may Allah have mercy on him) said: The hadith of al-Sa'b bin Jaththamah (may Allah be pleased with him) concerns the Umrah of the Prophet (peace and blessings be upon him). If it was his (peace and blessings be upon him) first Umrah, then Ibn Abi al-Huqayq had already been killed before it, and it is also said that it was in the same year; and if it was his (peace and blessings be upon him) last Umrah, then it was after the affair of Ibn Abi al-Huqayq. There is no doubt about this. He said: We do not know that the Messenger of Allah (peace and blessings be upon him) forbade the killing after having given a concession for it. Deliberately killing women and children is forbidden. "They are from among them" means: 1. They are not believers, which would make shedding their blood forbidden. 2. They are not under the ruling of safety, which would make raiding forbidden.
Al-Shaykh said: The hadith of al-Sa'b bin Jaththamah (may Allah be pleased with him) concerns his (peace and blessings be upon him) Umrah.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 18092