Allah, exalted be His praise, says: 'And take as witnesses two just men from among you.' [Surah al-Talaq: 2]
And He said: 'from among those whom you approve of as witnesses.' [Surah al-Baqarah: 282]
Imam al-Shafi'i (may Allah have mercy on him) said: "And we do not approve of the sinful (fasiq) among us; approval applies only to the just among us."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / Q20631