بسم الله الرحمن الرحيم
Allah has made the Muslim Ummah the best one to be raised for mankind. The reason for this description and how to live up to it, Allah ﷻ Said:
كُنتُمْ خَيْرَ أُمَّةٍ أُخْرِجَتْ لِلنَّاسِ تَأْمُرُونَ بِالْمَعْرُوفِ وَتَنْهَوْنَ عَنِ الْمُنكَرِ وَتُؤْمِنُونَ بِاللّهِ
“You are the best of people ever raised up for mankind; you enjoin Al-Ma‘roof and forbid Al-Munkar, and you believe in Allah…” 
Forbidding what is evil is one of the most important Islamic duties, indeed it is the noblest and most sublime. This is the task of the elite of mankind and ummah, as Allah ﷻ Said:
وَلْتَكُنْ مِنْكُمْ أُمَّةٌ يَدْعُونَ إِلَى الْخَيْرِ وَيَأْمُرُونَ بِالْمَعْرُوفِ وَيَنْهَوْنَ عَنِ الْمُنْكَرِ ۚ وَأُولَٰئِكَ هُمُ الْمُفْلِحُونَ
“Let there arise among you a group of people inviting to all that is good, enjoining Al-Ma’roof and forbidding Al-Munkar. And it is they who are the successful.” 
Neglecting in this duty brings with it, stern reprimand and threat of punishment. Hudayfah bin Yaman رضي الله عنه narrated that the Messenger of Allah ﷺ said:
والَّذي نَفسي بيدِهِ لتأمُرُنَّ بالمعروفِ ولتَنهوُنَّ عنِ المنكرِأو ليوشِكَنَّ اللَّهُ أن يبعثَ عليكُم عقابًا منهُ ثمَّ تَدعونَهُ فلايَستجيبُ لَكُم
“By Him in Whose Hand is soul, you either enjoin good and forbid evil, or Allah will certainly soon send His punishment upon you. Then you will make supplication and it will not be accepted.” 
Enjoining the good and forbidding the evil is an obligation to be carried out to the best of one’s ability, as the Prophet ﷺ said:
مَنْ رَأَى مِنْكُمْ مُنْكَرًا فَلْيُغَيِّرْهُ بِيَدِهِ فَإِنْ لَمْ يَسْتَطِعْ فَبِلِسَانِهِ فَإِنْ لَمْ يَسْتَطِعْ فَبِقَلْبِهِ وَذَلِكَ أَضْعَفُ الإِيمَانِ
“Whoever among you sees an evil action, let him change it with his hand [by taking action]; and if he cannot, then with his tongue [by speaking out]; and if he cannot, then with his heart [by feeling that it is wrong] – and that is the weakest of faith.” 
To fully understand this important and noble etiquette of forbidding evil, Ibn al-‘Uthaymeen mentioned five conditions by which one can measure his/her ability, means and relevance to enjoining and forbidding. 
First Condition: That he should know the Islamic ruling concerning what he is enjoining or forbidding, so he should only enjoin what he knows the Shari’ah enjoins, and he should only forbid what he knows the Shari’ah forbids; without relying on his (personal) taste or customs with regard to that.
Second Condition: That he should know the situation of the person being addressed – is he one who should be enjoined or forbidden or not? If he sees a person whom he’s unsure whether he is accountable or not, he should not enjoin anything upon him until he finds out.
Third Condition: That he should know about the person who appears to be accountable – has he done the action he wants to enjoin or not? (so for example) if he sees someone enter the mosque and sit down, and he’s unsure whether he performed tahiyyatul masjid, he should not denounce him or tell him to do it, rather he should find out more.
Fourth Condition: That he should be able to enjoin what is good and forbid what is bad, without bringing harm upon himself. If it will bring harm upon him, then he does not have to pursue it, but if he is patient and does it, then that is better, because all duties are subject to the condition that one is able to do them, because Allah ﷻ Said:
“So keep your duty to Allah and fear Him as much as you can.” 
“Allah burdens not a person beyond what he can bear.” 
Fifth Condition: That enjoining what is good and forbidding what is evil should not result in a greater evil than keeping quiet. If it will result as such, then he does not have to do it, indeed it is not permissible for him to enjoin what is good and forbid what is evil (in this situation).
For every individual therefore, the ability to prevent vice varies and is conditional. For some it may become necessary, yet for others it may turn out to be better if they avoided getting involved; this could be due their lack of knowledge or ability and means. In cases where attempting to prevent a vice leads to greater harm or vice, then it becomes impermissible and needs to be avoided altogether. This may be a temporary condition but important to note nevertheless. And Allah knows best.
Indeed it must not be forgotten that this foundational principle in Islam is a source of bringing about recitification and victory for the ummah. Ibn Uthaymeen said :
الأمر بالمعروف والنهي عن المنكر بهما قوام الأمة وصلاحها ونصرها وحصول الشرف والفضيلة لها
“Al ‘amr bil ma’roof wan-nahiy anil-munkar (collectively) strengths the Ummah (and brings about) its rectification and (increases) its righteousness and victory (thereby) earning its honour, dignity and distinct virtue.” 
May Allah grant us wisdom and insight to carry our duties with intelligence and diligence.
 Aal ‘Imran, 110
 Aal ‘Imran, 104
 At-Tirmidhi, 2169; graded as hasan by Ibn Hajar, al-Baghawi, al-Manawi and others; (see ‘Saheeh al-Jaami’, 7070)
 Saheeh Muslim, 49
 Majmu’ Fataawa ibn ‘Uthaymeen (8/652-654)
 At-Taghabun, 16
 Al-Baqarah, 286
 Sharh Thalathah al-Usool