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:8:72

Indeed, those who have believed and emigrated and fought with their wealth and lives in the cause of Allah and those who gave shelter and aided - they are allies of one another. But those who believed and did not emigrate - for you there is no guardianship of them until they emigrate. And if they seek help of you for the religion, then you must help, except against a people between yourselves and whom is a treaty. And Allah is Seeing of what you do.  

Truly those who believed and emigrated and strove with their wealth and their lives in the way of God, these being the Emigrants, and those who provided refuge, for the Prophet (s), and assisted, these being the Helpers, those are allies of one another, in terms of ˹mutual˺ support and inheritance. And those who believed but did not emigrate — you have no duty to make an alliance (read wilāya or walāya) with them, and so there is no inheriting between you and them and no share of the spoils for them, until they emigrate, this was abrogated by the end of this sūra; but if they ask you for assistance in the matter of religion then it is your duty to assist, them against the disbelievers, except against a folk between whom and you there is a covenant, a pact: in which case, do not assist them against these others and so break your pact; and God sees what you do.
القرآن:٨:٧٢

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

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