ثُمَّ أَنزَلَ عَلَیۡكُم مِّنۢ بَعۡدِ ٱلۡغَمِّ أَمَنَةࣰ نُّعَاسࣰا یَغۡشَىٰ طَاۤىِٕفَةࣰ مِّنكُمۡۖ وَطَاۤىِٕفَةࣱ قَدۡ أَهَمَّتۡهُمۡ أَنفُسُهُمۡ یَظُنُّونَ بِٱللَّهِ غَیۡرَ ٱلۡحَقِّ ظَنَّ ٱلۡجَـٰهِلِیَّةِۖ یَقُولُونَ هَل لَّنَا مِنَ ٱلۡأَمۡرِ مِن شَیۡءࣲۗ قُلۡ إِنَّ ٱلۡأَمۡرَ كُلَّهُۥ لِلَّهِۗ یُخۡفُونَ فِیۤ أَنفُسِهِم مَّا لَا یُبۡدُونَ لَكَۖ یَقُولُونَ لَوۡ كَانَ لَنَا مِنَ ٱلۡأَمۡرِ شَیۡءࣱ مَّا قُتِلۡنَا هَـٰهُنَاۗ قُل لَّوۡ كُنتُمۡ فِی بُیُوتِكُمۡ لَبَرَزَ ٱلَّذِینَ كُتِبَ عَلَیۡهِمُ ٱلۡقَتۡلُ إِلَىٰ مَضَاجِعِهِمۡۖ وَلِیَبۡتَلِیَ ٱللَّهُ مَا فِی صُدُورِكُمۡ وَلِیُمَحِّصَ مَا فِی قُلُوبِكُمۡۚ وَٱللَّهُ عَلِیمُۢ بِذَاتِ ٱلصُّدُورِ
Then after the distress, He sent down security for you. Slumber overtook a party of you, while another party was thinking about themselves (as how to save their ownselves, ignoring the others and the Prophet SAW) and thought wrongly of Allah - the thought of ignorance. They said, "Have we any part in the affair?" Say you (O Muhammad SAW): "Indeed the affair belongs wholly to Allah." They hide within themselves what they dare not reveal to you, saying: "If we had anything to do with the affair, none of us would have been killed here." Say: "Even if you had remained in your homes, those for whom death was decreed would certainly have gone forth to the place of their death," but that Allah might test what is in your breasts; and to Mahis that which was in your hearts (sins), and Allah is All-Knower of what is in (your) breasts.
https://quran.com/3/154
quran://3/154