Imam Al-Baqir (a.s.) said:
إنَّ الرَّجُلَ إذا أَصابَ مالاً مِنْ حَرَام لَمْ يُقْبَلْ مِنْه حَجُّ وَ لا عُمْرَةٌ وَ لا صِلَةُ رَحِم
Whenever a man gains a property in an illegitimate way, neither his Hajj and Umrah performed with that property is accepted, nor the uniting of kindred.1
Islam cares not only about the results but also about how the results are achieved. Those who are contented with their good deeds, but do not think about the means by which they perform the good deed, neglect this reality that none of them is accepted by God, unless the means are pure and sacred.