According to this hadith:
"Narrated Atiyyah al-Qurazi: I was among the captives of Banu Qurayzah. They (the Companions) examined us, and those who had begun to grow hair (pubes) were killed, and those who had not were not killed. I was among those who had not grown hair."
Abu Dawood - Sunan Abi Dawud 4404 ( Sahee )
Bani Qurayza tribe was responsible for breaking of treaty and joining the polytheist(Quraysh) army. So when the Muslims attacked Bani Qurayza, they killed all grown men. My question is, why did they kill all the men and not only those men(the leaders of Bani Qurayza) who broke the treaty?