It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Prophet (peace and blessings be upon him) gave Muhammad bin Maslamah (may Allah be pleased with him) a sword and said: "Fight the idolaters as long as they fight. Then if you see two swords clashing among the Muslims, strike (your sword on a rock) until it becomes blunt, and sit in your house until a decreed death comes to you, or a sinful hand." The narrator said: Then I came to Ibn Umar (may Allah be pleased with them both), and he too narrated to me something similar from the Prophet (peace and blessings be upon him).
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12912