Short answer
If you took reasonable care and believed they were eligible, your zakat counts in the Hanafi school, even if you later learn they were rich, a Sayyid or not Muslim. If you gave without any thought, or doubted and gave anyway without checking, and they turn out not to be eligible, you must pay again.
According to Abu Hanifa and Muhammad, if the payer judged after reasonable effort (taharri) that the recipient was eligible and it turns out he was rich, a Hashimi, a non-Muslim, or the payer's own parent or child, the zakat is valid and need not be repeated. Abu Yusuf held it must be repeated. If he gave without judging, or while in doubt, and the person was not eligible, it must be repeated.
Other madhhabs
- Hanbali
- If someone who seemed poor turns out to be rich, the zakat counts; if he turns out to be a non-Muslim or from Banu Hashim, it does not.
Explanation
You are asked to take reasonable care, not to investigate people's bank accounts. If someone looked needy, said they were in need, or was known to you as poor, and you gave in good faith, your zakat is done. The Prophet ﷺ told of a man whose charity reached a rich man by mistake, and he was told that it had been accepted, and that perhaps the rich man would learn from it and spend from what Allah had given him.
Reasonable care can mean:
- You know their situation, or someone reliable told you.
- They asked for help and showed signs of need.
- You gave through a trusted charity that checks eligibility.
You must pay again if you gave without thinking about eligibility at all, or you had doubts and gave without checking, and the person was not eligible. You must also pay again if you knew all along that they were not eligible.
On the other side, someone who knows they are not eligible must not keep zakat. If a rich person or a Sayyid was given zakat by mistake, they should return it or give it on to someone poor. The four schools differ on some of these cases; the Hanafi rule above is the generous one for the giver who acted in good faith. See who can receive zakat.
Ask a mufti about your own case. This answer explains the general ruling. When the details of your situation matter, as they do here, ask a qualified mufti and give them the full facts. Where to ask a scholar.
The evidence
Quran, Surah Al-Baqara 2:273
لِلْفُقَرَآءِ ٱلَّذِينَ أُحْصِرُوا۟ فِى سَبِيلِ ٱللَّهِ لَا يَسْتَطِيعُونَ ضَرْبًۭا فِى ٱلْأَرْضِ يَحْسَبُهُمُ ٱلْجَاهِلُ أَغْنِيَآءَ مِنَ ٱلتَّعَفُّفِ تَعْرِفُهُم بِسِيمَٰهُمْ لَا يَسْـَٔلُونَ ٱلنَّاسَ إِلْحَافًۭا ۗ وَمَا تُنفِقُوا۟ مِنْ خَيْرٍۢ فَإِنَّ ٱللَّهَ بِهِۦ عَلِيمٌ ﴿٢٧٣﴾
[Charity is] for the poor who have been restricted for the cause of Allah, unable to move about in the land. An ignorant [person] would think them self-sufficient because of their restraint, but you will know them by their [characteristic] sign. They do not ask people persistently [or at all]. And whatever you spend of good - indeed, Allah is Knowing of it.
People's true state is often hidden, so the giver goes by what appears.
Sahih al-Bukhari 1421
Sahih... وأما الغني فلعله يعتبر فينفق مما أعطاه الله ...
"As for the rich man, perhaps he will take a lesson and spend from what Allah has given him."
Charity that reached a rich man by mistake was accepted.
Sahih al-Bukhari 1422
Sahih... لك ما نويت يا يزيد ولك ما أخذت يا معن ...
"You have what you intended, Yazid, and you have what you took, Ma'n."
The giver is rewarded for his intention even when the charity reached someone he did not intend.
Where the ruling is recorded
- al-Hidaya, Kitab al-Zakat, chapter on those to whom zakat may and may not be paid, final section. One who gave after effort to someone he thought poor, who turned out rich, Hashimi, a non-Muslim, or his father or son, need not repeat it, per Abu Hanifa and Muhammad.
- al-Mughni, Kitab al-Zakat, on giving to one thought to be eligible. The Hanbali distinction between hidden wealth and other bars.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.