I heard the Messenger of Allah ﷺ say, "Allah does not accept a prayer performed without purification, nor charity given from the spoils of war taken unlawfully."
سمعت رسول الله ﷺ يقول: لا يقبل الله صلاة بغير طهور ولا صدقة من غلول.
Muslim narrated it in the chapter on Purification (224), where it states, on the authority of Musab bin Saad, who said, "Abdullah bin Umar visited Ibn Amir to check on him while he was ill, and Ibn Amir said, 'Won't you pray to Allah for me, Ibn Umar?' Ibn Umar said, 'I heard the Messenger of Allah ﷺ say,' and then he related the hadith, after which he said to him, 'You were governor of Basra.'""The meaning of this is that you are not free from misappropriation of spoils, for you were a governor over Basra, and there attached to you obligations arising from the rights of Allah Most High and the rights of people. The prayer is not accepted for someone in this condition, just as prayer and charity are not accepted except from those who are pure.""It appears, and Allah knows best, that Ibn Umar intended to rebuke Ibn Amir, urge him toward repentance, and encourage him to abandon his wrongdoings. He did not mean to categorically state that prayer for wrongdoers is of no benefit at all, for the Prophet ﷺ, as well as those who came before and after him, never ceased praying for disbelievers and sinners to be guided and to repent." This is as stated in Nawawi's commentary on Sahih Muslim.Ibn Amir is Abdullah bin Amir bin Kurayz, Abu Abdul-Rahman al-Qurashi, the maternal cousin of Uthman. He served as governor of Basra during the caliphate of Uthman , and it was he who conquered the region of Khurasan. He was known for his gentleness and forbearance.