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

It wasnarrated from Ibn ‘Umar that the Messenger of Allah (PBUH)said: “The Muslim is obliged to obey (the ruler) whether he likes itornot, unless he is commanded to commit an act of disobedience. If heis commanded to commit a sin then he should neither listen nor obey.” Translation Not Available

Book Ref: Sunan Ibn Majah Book 24 Hadith 2864
Web Ref:  Sunan Ibn Majah Vol 4 Book 24 Hadith 2864