Narrated Ibn `Umar:

That a man came to him (while two groups of Muslims were fighting) and said, "O Abu `Abdur Rahman! Don't you hear what Allah has mentioned in His Book: 'And if two groups of believers fight against each other...' (49.9) So what prevents you from fighting as Allah has mentioned in His Book?"' Ibn `Umar said, "O son of my brother! I would rather be blamed for not fighting because of this Verse than to be blamed because of another Verse where Allah says: 'And whoever kills a believer intentionally..." (4.93) Then that man said, "Allah says:-- 'And fight them until there is no more afflictions (worshipping other besides Allah) and the religion (i.e. worship) will be all for Allah (Alone)" (8.39) Ibn `Umar said, "We did this during the lifetime of Allah's Messenger (ﷺ) when the number of Muslims was small, and a man was put to trial because of his religion, the pagans would either kill or chain him; but when the Muslims increased (and Islam spread), there was no persecution." When that man saw that Ibn `Umar did not agree to his proposal, he said, "What is your opinion regarding `Ali and `Uthman?" Ibn `Umar said, "What is my opinion regarding `Ali and `Uthman? As for `Uthman, Allah forgave him and you disliked to forgive him, and `Ali is the cousin and son-in-law of Allah's Messenger (ﷺ) ." Then he pointed out with his hand and said, "And that is his daughter's (house) which you can see."

حَدَّثَنَا الْحَسَنُ بْنُ عَبْدِ الْعَزِيزِ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يَحْيَى، حَدَّثَنَا حَيْوَةُ، عَنْ بَكْرِ بْنِ عَمْرٍو، عَنْ بُكَيْرٍ، عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ ـ رضى الله عنهما ـ أَنَّ رَجُلاً، جَاءَهُ فَقَالَ يَا أَبَا عَبْدِ الرَّحْمَنِ، أَلاَ تَسْمَعُ مَا ذَكَرَ اللَّهُ فِي كِتَابِهِ ‏{‏وَإِنْ طَائِفَتَانِ مِنَ الْمُؤْمِنِينَ اقْتَتَلُوا‏}‏ إِلَى آخِرِ الآيَةِ، فَمَا يَمْنَعُكَ أَنْ لاَ تُقَاتِلَ كَمَا ذَكَرَ اللَّهُ فِي كِتَابِهِ‏.‏ فَقَالَ يَا ابْنَ أَخِي أَغْتَرُّ بِهَذِهِ الآيَةِ وَلاَ أُقَاتِلُ أَحَبُّ إِلَىَّ مِنْ أَنْ أَغْتَرَّ بِهَذِهِ الآيَةِ الَّتِي يَقُولُ اللَّهُ تَعَالَى ‏{‏وَمَنْ يَقْتُلْ مُؤْمِنًا مُتَعَمِّدًا‏}‏ إِلَى آخِرِهَا‏.‏ قَالَ فَإِنَّ اللَّهَ يَقُولُ ‏{‏وَقَاتِلُوهُمْ حَتَّى لاَ تَكُونَ فِتْنَةٌ‏}‏‏.‏ قَالَ ابْنُ عُمَرَ قَدْ فَعَلْنَا عَلَى عَهْدِ رَسُولِ اللَّهِ صلى الله عليه وسلم إِذْ كَانَ الإِسْلاَمُ قَلِيلاً، فَكَانَ الرَّجُلُ يُفْتَنُ فِي دِينِهِ، إِمَّا يَقْتُلُوهُ وَإِمَّا يُوثِقُوهُ، حَتَّى كَثُرَ الإِسْلاَمُ، فَلَمْ تَكُنْ فِتْنَةٌ، فَلَمَّا رَأَى أَنَّهُ لاَ يُوَافِقُهُ فِيمَا يُرِيدُ قَالَ فَمَا قَوْلُكَ فِي عَلِيٍّ وَعُثْمَانَ‏.‏ قَالَ ابْنُ عُمَرَ مَا قَوْلِي فِي عَلِيٍّ وَعُثْمَانَ أَمَّا عُثْمَانُ فَكَانَ اللَّهُ قَدْ عَفَا عَنْهُ، فَكَرِهْتُمْ أَنْ يَعْفُوَ عَنْهُ، وَأَمَّا عَلِيٌّ فَابْنُ عَمِّ رَسُولِ اللَّهِ صلى الله عليه وسلم وَخَتَنُهُ‏.‏ وَأَشَارَ بِيَدِهِ وَهَذِهِ ابْنَتُهُ أَوْ بِنْتُهُ حَيْثُ تَرَوْنَ‏.‏
Reference : Sahih al-Bukhari 4650
In-book reference : Book 65, Hadith 172
USC-MSA web (English) reference : Vol. 6, Book 60, Hadith 173
  (deprecated numbering scheme)