أَخْبَرَنَا الْحُسَيْنُ بْنُ مَنْصُورٍ، قَالَ حَدَّثَنَا مُبَشِّرُ بْنُ عَبْدِ اللَّهِ، قَالَ حَدَّثَنَا سُفْيَانُ بْنُ حُسَيْنٍ، عَنْ يَعْلَى بْنِ مُسْلِمٍ، عَنْ جَابِرِ بْنِ زَيْدٍ، قَالَ قَالَ ابْنُ عَبَّاسٍ إِنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم وَأَبَا بَكْرٍ وَعُمَرَ كَانُوا مِنَ الْمُهَاجِرِينَ لأَنَّهُمْ هَجَرُوا الْمُشْرِكِينَ وَكَانَ مِنَ الأَنْصَارِ مُهَاجِرُونَ لأَنَّ الْمَدِينَةَ كَانَتْ دَارَ شِرْكٍ فَجَاءُوا إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم لَيْلَةَ الْعَقَبَةِ ‏.‏

It was narrated that Jabir bin Zaid said: "Ibn 'Abbas said:'The Messenger of Allah (PBUH), Abu Bakr and 'Umar were among the Muhajirin (emigrants), because they forsook (hajaru) the idolators, andsome of the Ansar were Muhajirun because Al-Madinah was a land of shirk, and they came to the Messenger of Allah (PBUH) on the Night of Al-'Aqabah."' Translation Not Available

Book reference: Sunan An Nisai Book 39 Hadith 4166
Web reference: Sunan An Nisai Volume 1 Book 3 Hadith 4171