Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:5:12

And Allah had already taken a covenant from the Children of Israel, and We delegated from among them twelve leaders. And Allah said, "I am with you. If you establish prayer and give zakah and believe in My messengers and support them and loan Allah a goodly loan, I will surely remove from you your misdeeds and admit you to gardens beneath which rivers flow. But whoever of you disbelieves after that has certainly strayed from the soundness of the way."  

God had made a covenant with the Children of Israel, for what will be mentioned shortly, and We raised up (there is a shift of address away from the third ˹to the first˺ person) from among them twelve leaders, from each tribe one leader, to be responsible for his people’s fulfilment of the covenant, as a way of binding them ˹to it˺. And God said, to them: ‘I am with you, helping and assisting. Surely if (la-in, the lām is for oaths) you establish the prayer, and pay the alms, and believe in My messengers and succour them, help them, and lend to God a goodly loan, by expending in His way, I will absolve you of your evil deeds, and I will admit you to gardens underneath which rivers flow. So whoever of you disbelieves after that, covenant, surely he has strayed from the right way’, he has erred from the path to Paradise (al-sawā’ originally means ‘the middle way’). And they broke the covenant.
القرآن:٥:١٢

وَلَقَدْ أَخَذَ اللَّهُ مِيثَاقَ بَنِي إِسْرَائِيلَ وَبَعَثْنَا مِنْهُمُ اثْنَيْ عَشَرَ نَقِيبًا ۖ وَقَالَ اللَّهُ إِنِّي مَعَكُمْ ۖ لَئِنْ أَقَمْتُمُ الصَّلَاةَ وَآتَيْتُمُ الزَّكَاةَ وَآمَنْتُمْ بِرُسُلِي وَعَزَّرْتُمُوهُمْ وَأَقْرَضْتُمُ اللَّهَ قَرْضًا حَسَنًا لَأُكَفِّرَنَّ عَنْكُمْ سَيِّئَاتِكُمْ وَلَأُدْخِلَنَّكُمْ جَنَّاتٍ تَجْرِي مِنْ تَحْتِهَا الْأَنْهَارُ ۚ فَمَنْ كَفَرَ بَعْدَ ذَٰلِكَ مِنْكُمْ فَقَدْ ضَلَّ سَوَاءَ السَّبِيلِ  

{ولقد أخذ الله ميثاق بني إسرائيل} بما يذكر بعد {وبعثنا} فيه التفات عن الغيبة أقمنا {منهم اثني عشر نقيبا} من كل سبط نقيب يكون كفيلا على قومه بالوفاء بالعهد توثقة عليهم {وقال} لهم {الله إنِّي معكم} بالعون والنصرة {لئن} لام قسم {أقمتم الصلاة وآتيتم الزكاة وآمنتم برسلي وعزَّرتموهم} نصرتموهم {وأقرضتم الله قرضا حسنا} بالإنفاق في سبيله {لأكفرنَّ عنكم سيئآتكم ولأدخلنكم جنات تجري من تحتها الأنهار فمن كفر بعد ذلك} الميثاق {منكم فقد ضل سواء السبيل} أخطأ طريق الحق. والسواء في الأصل الوسط فنقضوا الميثاق قال تعالى.