Sunan an-Nasa'i #4166 · The Book of al-Bay'ah

Sunan an-Nasa'iIt was narrated that Jabir bin Zaid said
Sunan an-Nasa'i · Book 39 · The Book of al-Bay'ah
Sunan an-Nasa'i · كتاب 39 · كتاب البيعة
"Ibn 'Abbas said: 'The Messenger of Allah (ﷺ), Abu Bakr and 'Umar were among the Muhajirin (emigrants), because they forsook (hajaru) the idolators, and some of the Ansar were Muhajirun because Al-Madinah was a land of shirk, and they came to the Messenger of Allah (ﷺ) on the Night of Al-'Aqabah
أَخْبَرَنَا الْحُسَيْنُ بْنُ مَنْصُورٍ، قَالَ حَدَّثَنَا مُبَشِّرُ بْنُ عَبْدِ اللَّهِ، قَالَ حَدَّثَنَا سُفْيَانُ بْنُ حُسَيْنٍ، عَنْ يَعْلَى بْنِ مُسْلِمٍ، عَنْ جَابِرِ بْنِ زَيْدٍ، قَالَ قَالَ ابْنُ عَبَّاسٍ إِنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم وَأَبَا بَكْرٍ وَعُمَرَ كَانُوا مِنَ الْمُهَاجِرِينَ لأَنَّهُمْ هَجَرُوا الْمُشْرِكِينَ وَكَانَ مِنَ الأَنْصَارِ مُهَاجِرُونَ لأَنَّ الْمَدِينَةَ كَانَتْ دَارَ شِرْكٍ فَجَاءُوا إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم لَيْلَةَ الْعَقَبَةِ ‏.‏
Reference : Sunan an-Nasa'i 4166In-book reference : Book 39, Hadith 18