Sahih al-Bukhari, Hadith 3179

Narrated `Ali: We did not, write anything from the Prophet except the Qur'an and what is written in this paper, (wherein) the Prophet said, "Medina is a sanctuary from (the mountain of) Air to so and-so, therefore, whoever innovates (in it) an heresy or commits a sin, or gives shelter to such an innovator, will incur the Curse of Allah. the angels and all the people; and none of his compulsory or optional good deeds of worship will be accepted And the asylum granted by any Muslim Is to be secured by all the Muslims even if it is granted by one of the lowest social status among them. And whoever betrays a Muslim in this respect will incur the Curse of Allah, the angels and all the people, and his compulsory and optional good deeds of worship will not be accepted. And any freed slave will take as masters (befriends) people other than his own real masters who freed him without taking the permission of the latter, will incur the Curse of Allah, the angels and all the people, and his compulsory and optional good deeds of worship will not be accepted."

حَدَّثَنَا مُحَمَّدُ بْنُ كَثِيرٍ، أَخْبَرَنَا سُفْيَانُ، عَنِ الأَعْمَشِ، عَنْ إِبْرَاهِيمَ التَّيْمِيِّ، عَنْ أَبِيهِ، عَنْ عَلِيٍّ ـ رضى الله عنه ـ قَالَ مَا كَتَبْنَا عَنِ النَّبِيِّ صلى الله عليه وسلم إِلاَّ الْقُرْآنَ، وَمَا فِي هَذِهِ الصَّحِيفَةِ، قَالَ النَّبِيُّ صلى الله عليه وسلم ‏ "‏ الْمَدِينَةُ حَرَامٌ مَا بَيْنَ عَائِرٍ إِلَى كَذَا، فَمَنْ أَحْدَثَ حَدَثًا، أَوْ آوَى مُحْدِثًا، فَعَلَيْهِ لَعْنَةُ اللَّهِ وَالْمَلاَئِكَةِ وَالنَّاسِ أَجْمَعِينَ، لاَ يُقْبَلُ مِنْهُ عَدْلٌ وَلاَ صَرْفٌ، وَذِمَّةُ الْمُسْلِمِينَ وَاحِدَةٌ يَسْعَى بِهَا أَدْنَاهُمْ‏.‏ فَمَنْ أَخْفَرَ مُسْلِمًا فَعَلَيْهِ لَعْنَةُ اللَّهِ وَالْمَلاَئِكَةِ وَالنَّاسِ أَجْمَعِينَ، لاَ يُقْبَلُ مِنْهُ صَرْفٌ وَلاَ عَدْلٌ، وَمَنْ وَالَى قَوْمًا بِغَيْرِ إِذْنِ مَوَالِيهِ فَعَلَيْهِ لَعْنَةُ اللَّهِ وَالْمَلاَئِكَةِ وَالنَّاسِ أَجْمَعِينَ، لاَ يُقْبَلُ مِنْهُ صَرْفٌ وَلاَ عَدْلٌ ‏" ‏‏.‏

sunnah.com