The Banu Nazir and other Jewish tribes after being exiled from Madinah had settled at Khyber where they were always plotting against the Muslims. They had the support of the Ghatafan tribe and the hypocrites of Madinah.
When they came to know of the terms, which the Holy Prophet PBUH had agreed to at Hudaibiya, they took it as a sign of weakness or almost a deteat for him and began to make preparations for attacking Madinah.
The Holy Prophet PBUH came to know of these developments and marched with an army of sixteen hundred men against the Jews of Khyber. Seeing the Muslim army under the Holy Prophet PBUH, the Jews shut themselves up in their seven well-guarded fortresses, of which the strongest and best fortified was Qamus. There was a force of about 20,000 Jews in these forts from where they hurled stones and showered arrows on the Muslim army.
The Holy Prophet PBUH did not want a long siege, so he ordered an attack. The Muslims captured all fortress without much difficulty, but when they reached the fort of Qamus, the fight prolonged to twenty days. Each day, they had to return without success, until one day, the Holy Prophet PBUH sent Hazrat Ali as commander of the troops for the day’s fight.
Seeing the Muslims under the command of Hazrat Ali, Marhab, the famous warrior of the Jews came out or the fort to fight against him. Hazrat Ali Killed him in the first attack. Then a fierce battle started in which the Jews were forced to surrender and the Muslims captured the fort.
The Jews requested the Holy Prophet PBUH to grant them peace. The Holy Prophet PBUH allowed them to stay in Khyber on the condition that they would live in peace, and give half of the produce of their land to the Muslims.