Ubaydullah bin Adi came to Uthman (may Allah be pleased with him) while he was under siege, and Ali (may Allah be pleased with him) was leading the people in prayer. He said: "I feel uneasy praying with these people while you are the imam." Uthman (may Allah be pleased with him) said: "Prayer is the best of all that people do. When you see them doing good, do good along with them; and when you see people doing wrong, keep away from their wrongdoing."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5311