I have a friend who is a government employee. He was tempted by evil companions to take bribes, and he kept doing this
for many years. Now he has performed Tawbah (repentance to Allah), praise be to Allah. He observes Sawm (fasting), offers Salah (Prayer), gives Sadaqah (voluntary charity) and tries to do forms of goodness. He performed `Umrah twice and Hajj once. He has acquired wealth through bribery during those years. As he is still an employee, he cannot return the bribes to the people who gave them to him, as this is going to harm his reputation and might render him legally responsible for this crime. He also cannot find these people, as some of them died. What should he do now? Is it permissible for him to estimate the sums of money he took as a bribe and use them to build a Masjid (mosque), (Part No. 23; Page No. 546) carry out any charitable project, such as organizations for memorizing the Qur'an or orphanages, or give them as Zakah to those who deserve it?
If the situation is as you have mentioned, he should perform Tawbah by quitting this, regretting it, insisting on not doing it again and returning the rights to their owners as much as possible. If this is not possible, he should spend the money in different forms of charity on behalf of the wronged people.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.