The Messenger of Allah ﷺ said, "Whoever sincerely seeks martyrdom will be granted it, even if it does not befall him."
قال رسول الله ﷺ: من طلب الشهادة صادقا أعطيها، ولو لم تصبه.
Muslim narrated it in the Book of Governance (1908:156) from Shayban bin Farroukh, who said, "Hammad bin Salama narrated to us, who said, 'Thabit narrated to us, from Anas bin Malik,'" and he mentioned it.