If one prays while being confident he is pure, but then realizes he was impure, is his Salat valid?
Yes, his prayer is valid.