Imam al-Shafi'i (may Allah have mercy on him) said: Whoever considers false testimony against a man permissible, or considers shedding someone's blood or seizing his wealth permissible, his testimony will be rejected. And a man who swears an oath on someone's behalf and testifies for him, though he was not present on that occasion and had not heard about it, his testimony too will be rejected. Or a man who testifies against someone out of enmity, his testimony too will be rejected.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20904