All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Istinja’ is cleaning the private parts (front and back) from impurities, using water and other permissible items like stones and paper. One should wait enough time after urination so that the remaining urine in his penis comes out, shake the penis and press it gently with one's fingers (and then wash it). A Muslim should not take this matter lightly for negligence in this regard entails torture in the grave. Ibn ‘Abbaas narrated that the Prophet, sallallaahu ‘alayhi wa sallam, said: "Most of the torture of the grave is because of urine (not cleansing one’s body and clothes properly from urine)." [Al-Hakim]
Ibn ‘Abbaas also narrated that the Prophet, sallallaahu ‘alayhi wa sallam, passed by two graves and said: "They are being tortured, but they are tortured for something that was not difficult to avoid. One of them did not use to take precautions to avoid (his body or clothes being soiled by) urine, and the other used to walk around spreading tales." [Al-Bukhari, Muslim and others]
A Muslim should also be careful of exaggeration in this for it brings obsession and Satanic whispers. When a Muslim relieves himself and thinks that the flow of urine has stopped and then he removes the impurity with a stone or by washing and then makes Wudhoo’ (ablution) for prayer, he has to avoid doubt unless he is certain that he has released something. In the latter case, he has to redo Istinja’ (cleaning with water) and Wudhoo’ (ablution). As evidence, it is narrated on the authority of ‘Abdullah ibn Zayd Al-Mazni that a man came to the Prophet, sallallaahu ‘alayhi wa sallam, and said: "One becomes doubtful during the prayer of having released something (what should he do)?" The Messenger of Allaah, sallallaahu ‘alayhi wa sallam, said: "He should not leave unless he hears a sound or perceives a smell (of passing wind)." [Saheeh]
A person who was ignorant about the rulings of Istinja’ in the past and prayed with impurity on his body or clothes is excused for ignorance, and his prayer is valid.
Allaah Knows best.