Praise be to Allah.
When the Prophet (blessings and peace of Allah be upon him) migrated from Makkah to Madinah, there were three Jewish tribes in Madinah: Banu Qaynuqaa‘, Banu an-Nadeer and Banu Qurayzah. The Prophet (blessings and peace of Allah be upon him) invited them to Islam, but most of them insisted on disbelieving. He drew up a covenant with them (i.e., a binding contract) then they waged war against him. Ibn al-Qayyim (may Allah have mercy on him) said:
All three (Jewish tribes) waged war against him. He let off Banu Qaynuqaa‘, expelled Banu an-Nadeer, and killed Banu Qurazah and took their women and children captive. Soorat al-Hashr was revealed concerning Banu an-Nadeer, and Soorat al-Ahzaab was revealed concerning Banu Qurayzah.
Zaad al-Ma‘aad (3/59)
To sum up what the scholars of seerah and maghaazi (Prophet’s biography and military campaigns) said about Banu Qurayzah:
When the Messenger of Allah (blessings and peace of Allah be upon him) finished digging the trench, Quraysh came with ten thousand of their ahaabeesh (a group of people who did not belong to any one tribe) and those who followed them of Banu Kinaanah and the people of Tihaamah, and Ghatafaan came with those who followed them of the people of Najd. The Messenger of Allah (blessings and peace of Allah be upon him) and the Muslims came out until they put their backs towards Sal‘ – a mountain in Madinah – with three thousand Muslims. He set up his camp there, and the trench was between him and the enemy. He issued orders that the children and women be taken up into the forts, and he appointed Ibn Umm Maktoom in charge of Madinah.
Huyayy ibn Akhtab al-Nadari set out and went to Ka‘b ibn Asad al-Qurazi, who was the one who had made a treaty and covenant (with the Prophet (blessings and peace of Allah be upon him)) on behalf of Banu Qurayzah. When Ka‘b heard about that, he shut the door of his fort in Huyayy’s face. He asked permission to enter, but he refused to open the door to him, so he called out to him: Woe to you, O Ka‘b! Open the door! Ka‘b said: Woe to you, O Huyayy! You are a man of ill omen and I have made a treaty with Muhammad; I will not break the treaty between me and him, for I have not seen anything from him but faithfulness and truthfulness. Huyayy said: Woe to you! Open the door so that I may speak to you. And he kept on him until he opened the door, then he kept pleading with him until he agreed to break his treaty with the Messenger of Allah (blessings and peace of Allah be upon him), on condition that Huyayy give him a solemn pledge by Allah that if Quraysh and Ghatafaan went back without having killed Muhammad, he would enter his fort with him and share his fate. Thus Ka‘b ibn Asad broke his treaty and freed himself from the covenant that had been between him and the Messenger of Allah (blessings and peace of Allah be upon him).
When the news reached the Messenger of Allah (blessings and peace of Allah be upon him) and the Muslims, he sent Sa‘d ibn Mu‘aadh, who was the chief of al-Aws at that time, and Sa‘d ibn ‘Ubaadah, who was the chief of al-Khazraj, along with ‘Abdullah ibn Rawaahah and Khawwaat ibn Jubayr, who went to them, to call them to make peace and renew the alliance. They said: Now after you have weakened us and has expelled them, meaning Banu an-Nadeer?! And they spoke disparagingly of the Messenger of Allah (blessings and peace of Allah be upon him. Sa‘d ibn ‘Ubaadah began to trade insults with them, then Sa‘d ibn Mu‘aadh called out to them: You know what there is between us and you, O Banu Qurayzah, and I fear for you a fate like that of Banu an-Nadeer or even worse. But they reviled him and spoke disparagingly of the Messenger of Allah (blessings and peace of Allah be upon him). They said: Who is the Messenger of Allah? There is no covenant or agreement between us and Muhammad. So Sa‘d ibn Mu‘aadh traded insults with them, and he was a hot tempered man.
They went back to the Messenger of Allah (blessings and peace of Allah be upon him) and told him what had happened, and the situation became serious and fear was everywhere. Their enemy came at them from above and below until the believers thought all sorts of things and hypocrisy rose to the surface.
The Messenger of Allah (blessings and peace of Allah be upon him) stood on guard, and the mushrikeen continued to besiege him for twenty-odd days, nearly a month, but there was no fighting between them apart from some shooting with arrows.
The Messenger of Allah (blessings and peace of Allah be upon him) and his Companions remained as Allah described it, in a state of hardship and fear, because their enemy gathered together against them and came at them from above and below.
Then Nu‘aym ibn Mas‘ood came to the Messenger of Allah (blessings and peace of Allah be upon him) and said: O Messenger of Allah, I have become Muslim and my people do not know that I have become Muslim; instruct me as you wish. The Messenger of Allah (blessings and peace of Allah be upon him) said: “You are just one man among us; try to stir up division among them so as to weaken their resolve if you can, for war is deceit.” Nu‘aym ibn Mas‘ood went out and came to Banu Qurayzah, as he had been a friend of theirs during the Jaahiliyyah. He said to them: Quraysh and Ghatafaan have come to fight Muhammad and his Companions, and you have supported them against him, and their land, their women and their wealth are elsewhere, so they are not like you. If they see an opportunity, they will take it, otherwise they will go back to their own country and leave you alone with the man in your country, and you will not be able to stand up to him if you are left alone. So do not fight with these people until you take hostages from among their leaders, who will be in your hands as a guarantee so that you will fight Muhammad with them until you defeat him. And they said: You have given good advice.
Then he went to Quraysh and said to Abu Sufyaan ibn Harb and the men of Quraysh who were with him: You should know that the Jews regret what has happened between them and Muhammad, and they have sent word telling him: We regret what we did; will it please you if we capture some of the leaders of the two tribes, Quraysh and Ghatafaan, and give them to you so that you may strike their necks, then we will be with you against whoever among them is left until we eradicate them? And he has sent word to them agreeing to that. So if the Jews send anyone to you, asking you for hostages from among your men, do not give them even one man.
Then he went out and came to Ghatafaan and said something similar to them as he had said to Quraysh, and issued a similar warning to them.
Then Allah created dissent among them. And Allah sent a wind on an intensely cold winter’s night, which overturned their cooking pots and tents.
And Allah, may He be exalted, revealed the words (interpretation of the meaning):
“O you who believe! Remember Allah's Favour to you, when there came against you hosts, and We sent against them a wind and forces that you saw not [i.e. troops of angels during the battle of AlAhzab (the Confederates)]. And Allah is Ever All-Seer of what you do… .
And Allah drove back those who disbelieved in their rage, they gained no advantage (booty, etc.). Allah sufficed for the believers in the fighting (by sending against the disbelievers a severe wind and troops of angels). And Allah is Ever All-Strong, All-Mighty.
And those of the people of the Scripture who backed them (the disbelievers) Allah brought them down from their forts and cast terror into their hearts, (so that) a group (of them) you killed, and a group (of them) you made captives.
And He caused you to inherit their lands, and their houses, and their riches, and a land which you had not trodden (before). And Allah is Able to do all things.”
That is, Allah diverted their enemy from them by means of the wind that He sent against them and the troops of angels and others whom Allah sent to them. “Allah sufficed for the believers in the fighting” means: they did not need to engage in fighting with them; rather the Most Strong, the Almighty, diverted them by His might and power.
Al-Bukhaari (4114) and Muslim (2724) narrated from Abu Hurayrah that the Messenger of Allah (blessings and peace of Allah be upon him) said: “There is no god but Allah alone, He granted victory to His troops, supported His slave and defeated the confederates alone, and there is nothing after Him.”
When the Prophet (blessings and peace of Allah be upon him) returned from the battle of the Trench, and laid down his weapon and did ghusl – as narrated by al-Bukhaari (4117) – Jibreel (peace be upon him) came to him and said: Have you laid down your arms? For by Allah, we (angels) have not laid down ours; go out to them. He said: “Where to?” He said: Over there – and he pointed in the direction of Banu Qurayzah. So the Prophet (blessings and peace of Allah be upon him) went out to them, and besieged them with detachments of Muslims for umpteen days. Allah cast fear into their hearts and the siege became intense, until they agreed to accept the ruling of Sa‘d ibn Mu‘aadh, as they had been his allies. His verdict concerning them was in accordance with the ruling of Allah: their fighters were to be killed and their women and children taken captive.
The Messenger of Allah (blessings and peace of Allah be upon him) detained them in Madinah, then he went out to the marketplace of Madinah and dug trenches in it, then he sent for them and struck their necks in those trenches as they were brought out to him in batches. They said to Ka‘b ibn Asad as they were being taken to the Messenger of Allah (blessings and peace of Allah be upon him) in batches: O Ka‘b, what do you think will be done to us? He said: Will you never understand? Don’t you see that the caller does not stop and that whoever among you is taken away does not return? By Allah it is death. And this went on until they were finished with.
The Messenger of Allah (blessings and peace of Allah be upon him) issued instructions to execute every one of them who had grown pubic hair, and whoever had not grown pubic hair was left alone. Abu Dawood (4404) narrated with a saheeh isnaad from ‘Atiyyah al-Qurazi (may Allah be pleased with him) he said: I was among the captives of Banu Qurayzah, and they examined (us). Those whose pubes had started to grow were executed and those whose pubes had not started to grow were not executed. I was among those whose pubes had not started to grow.
According to another report: They uncovered my private part and saw that my pubes had not yet started to grow, so they put me with the captive women and children.
See: al-Bidaayah wa’n-Nihaayah (6/34-94); Siyar A‘laam an-Nubala’ (1/470-480); Tareekh al-Islam (2/307-318); ar-Rawd al-Unuf (6/262-294)
Thus the Prophet (blessings and peace of Allah be upon him) put an end to the Jews of Banu Qurayzah who broke the treaty and formed an alliance with the mushrikeen to eradicate Islam and its people. So their plot backfired and they themselves were eradicated to the last man. Praise be to Allah, the Lord of the worlds.
And Allah knows best.