There was a battle during this time called "The Battle of the Ditch", in which all of the Arabs who were non-Muslims united together to extinguish Islam for once and for all. When the Prophet (SAW) heard about this, he gathered his Sahaba to consult with them the best way to preserve the flickering flame called Islam. A Sahabi named Salman al Farsi came up with the idea that in order to defend themselves, a big ditch can be made around the city of Medina, which will make it difficult for the enemies to cross over. The Muslims would then defend different areas of the ditch, and that would be their method of fighting back - being defensive rather than attacking, mainly. The enemies of Islam then came in a massive amount, but the trench had worked, even though it was a fierce battle outside of the trench. The Muslims were protected inside and they were along with the second Bani Israel tribe with who they had a covenant. However, the people from outside sent a message to the Bani Israel tribe inside, to attack the Muslims from inside Medina, which would be breaking the covenant. But betraying the Muslims in this way, the religion of Islam would be extinguished. The Muslims outside Medina were already barely surviving, so their plan was to get the Bani Quraiza tribe inside to declare war on the Muslims as well, and defeat them all, even though this tribe is actually supposed to be defending one part of the trench.
Initially, the leader of the tribe would not even listen to the message given by the leader of the enemies, saying that you are just a fitna to the community, and you have already ruined your own people. The leader of the outside tribe insisted that he just wants to talk, and eventually he said something that made the leader of the second tribe let him in - he said that you have food inside, but you don't want me to have any of it. Have you become so cheap as not to offer your guest any food? And this was like an insult to the tribal leader, and he let him in. So the outside leader now got the chance to convince the second tribe's leader to declare war on the Muslims, thereby bringing back pride on the Bani Israel. The tribal leader was now convinced. Word began to spread that this tribe will break the covenant that they made with the Prophet (SAW), and will fight against the Muslims, until it eventually reached Hazrat Umar (RA). Hazrat Umar went to the Prophet (SAW) and told him the news, and the Prophet was worried, and told him to confirm this, but not tell anyone else if it is true. When Hazrat Umar soon confirmed the news and told the Prophet (SAW), it forced the Prophet to call back a large quantity of troops who were outside Medina protecting the trench to come back to the city and patrol the city to protect them women and children they had left behind. Because of this, the kuffar were finally able to pass over the ditch, since Muslims were not defending it. The kuffar came with full-force to attack the weak defendants now. This was one of the most stressful days for the Prophet (SAW), and he was fighting for so long at the border that he had missed four prayers while in battle. The Sahaba had also missed their prayers, and complained to the Prophet about it, even though their life, deen and family were in jeopardy. Yet, they cared so much about their prayers. The Prophet (SAW) told them that he too has missed his prayers, and they should keep fighting. However, he cursed the enemies for making him miss his prayers. This is how much prayers were valued.
There was one man in this battle, who was from the kuffar's side. However, once in a battle before this, he was held captive by the Muslims, and was surprised at how much they took care of him and were gentle with him. This made him have a soft spot for Islam. During this battle, he came to the Prophet (SAW) and converted to Islam. He asked if he could then go to the two tribes pretending he was still a kafir, and deceiving them that way. The Prophet said that war is deception and you can do what you want to do. What this man did was he went to the leader of the second tribe in Medina, and said that the Quraysh are planning to leave the war, and this will leave you fighting alone with the Muslims. You should call 5 eminent people from their tribe to protect you. This way they will make sure that the kuffar don't leave the important men behind. Then he went to the kuffar and said that you don't know what's going on. The Bani Quraiza is planning to turn their back on you. They will ask you for some men, and then they will hand them to the Prophet (SAW), and he will forgive you and you can kill those men. The convert made it a point to tell them that when these people from Bani Quraiza come to ask for the men, it's a sign that they've turned their back on the kuffar. So the men should not be given. Having deceived both the kuffaar and the Bani Israel, this man then left.
As planned, the Bani Quraiza asked for the men, and the kuffar figured that it's true that they have turned their back on them. This led to a breaking of connection between the two tribes. Now that the first alliance was broken, the Prophet (SAW) did not have to worry about the inner aspect of Medina. Then Allah sent a severe cold weather and storm to the place which dispersed the enemies even more. The Sahaba were extremely exhausted after this battle, they were tested to the extreme limit. If we look at the ayahs about their state in the Quran during this time, it says that "their hearts were coming out of their throats". That is how bad the situation was.
When Prophet Muhammad (SAW) noticed that the kuffar and Quraish were leaving, he began to relax and put down his armor, indicating that the Sahabis can do the same. However, angel Jibrael (AS) came to him and asked why he put down the armor, because the angels who are fighting in this battle hadn't done so yet. Jibrael (AS) said that we need to get the Bani Quraiza, because they broke the covenant. Then Rasul Allah (SAW) made the announcement, "None of you shall pray Asr until you reach the Bani Quraiza". This is a famous hadith. The Muslims then went to the fortress of the Bani Quraiza, making a siege around it. This fortress was very protected and no one had ever broken it before. The tribe decided not to come out of their fortress and didn't fight. Instead, they stayed inside and thought they had enough food to last them, and meanwhile the Prophet (SAW) and his companions would give up and leave. The Prophet (SAW) stayed there for 25 days waiting for them. In the end, the Bani Quraiza decided that they would accept one of the companions to be the arbitrator and settle the dispute. The tribe chose Saad (RA) as their arbitrator, thinking that he would be easy on them because he was connected to the tribe of Aus, which used to be linked to Bani Quraiza before. They thought he would tell them to leave a part of their wealth like the Bani Nazir had to, and they could easily leave. Both the Prophet (SAW) and the tribe decided that Saad (RA) will make the final decision as to what happens to these people. In the end, he decided that the men's head be severed from their neck, and the women and children be held as captives, and this was what was done. This is the extreme disgrace this tribe had to go through because of breaking their trust like this and thinking that Allah (SWT) is not watching them when they made a decision to declare war on the Muslims. They had mocked the Scripture, and so they were humiliated. They are disgraced in this world and the next.
The mistake of the two tribes was that they made a mockery of the Words of Allah, choosing what they wanted to and leaving what they desired. Even though their intention initially was a good one, to find the Prophet (SAW) and learn from him, but by making a mockery of the Shariah they called upon themselves this fate. We might think that we as Muslims don't do this, but there are so many examples of people accepting some ayahs of the Quran and rejecting others. For example, we all say that alcohol is haram. But in the same Book, Allah (SWT) prohibits the taking of interest, yet most of us do it. We just ignore this ayah completely sometimes, by buying things on a credit card that we can't afford, or sending our kids for an education which we can't afford. We think it's a necessity, even though the student could go to a community college and save up to go to the good school when he can afford it. Both alcohol and interest are said to be haram, but we choose to follow one and not the other. Sometimes Muslims even follow a part of one ayah and reject a part of the same ayah. There is an ayah that says, "They ask you (O' Muhammad [SAW]) about wine and gambling. Say, in these two things is a very big sin. There is some benefit in it, but the sin of these two is much bigger than the benefit," and so both of these things are impermissible. We all know that going to a casino or trying to play a lotto is haram, but we fail to realize that things like life insurance are a sort of gamble as well. We keep giving money, betting on our life, waiting for the "jackpot" if it's needed. There are some sorts of insurance that the Shariah and scholars give lenience to, like car insurance, because the government mandates a car to be insured. A car is a necessity, and the government requires one to have at least limited liability for a car, so it's allowed. We are not talking about full coverage here, but limited liability. The second exception is health insurance, because the system is so corrupt here that one can't survive without health insurance. Most people are not able to afford the bills of hospitals etc. Life insurance is out of the question, but car and health insurance are allowed because of the current situation. We should still make dua that Allah makes ways for us to get out of these situations, but until then, the scholars say there is room for leniency here.
In ayah 86, Allah (SWT) tells us about the main disease, "Those are they who have bought the life of this world at the price of the Hereafter. Their torment shall not be lightened nor shall they be helped." The symptoms of the disease were breaking the covenant, but the main cause of the disease was that they were ready to trade this world with the next. This is the main thing that needs to be cured in all Muslims. The life of the Hereafter is the permanent abode. We shouldn't get misguided in this life by worldly pleasures that are sinful, as they are all temporary pleasures. What remains after sinning for pleasure leaves an emptiness. The real enjoyment is in the Hereafter. Allah (SWT) only prohibits us to look at two things, looking at non-mahrams, and looking at the wealth of the kuffar. Because the world is amassing wealth, yet a Muslim is giving his wealth out to charity. We need to turn our attention to Allah (SWT) and the Everlasting life in order to cure ourselves from this disease.
May Allah (SWT) give us the tawfiq and wisdom to understand and follow the Quran completely, and may He give us the tawfiq to turn our focus to the Afterlife rather than being absorbed completely in this life. Ameen.