A new and novel nanocomposite cation exchanger polyaniline-Sn(IV)iodophosphate (PANI-SnIP) has been synthesized using a sol−gel method by the incorporation of precipitates of Sn(IV)iodophosphate into the matrices of polyaniline. The ion exchange capacity of the composite synthesized at pH 1.0 was found to be 1.2 mequiv g −1 for Na + ion. The characterization of the material using simultaneous thermogravimetry−differential thermal analysis (TGA-DTA), Fourier transform infrared (FTIR), X-ray diffraction (XRD), scanning electron microscopy (SEM), and transmission electron microscopy (TEM) reveals the composite nature of the material with uniform surface morphology and formation of particles of size ranging from 20−25 nm. Study of the various physicochemical properties indicates granulometric nature, fairly good thermal and chemical stability, uniform elution, and bifunctional behavior of the exchanger. The selectivity of the composite for Hg 2+ , Pb 2+ , and Ce 4+ in different solvent media along with their reproducible quantitative separation from binary mixture as well as real samples makes it a potential environmental wastewater detoxicant. The limit of detection (LOD) and limit of quantification (LOQ) for Hg 2+ were found to be 0.53 and 1.9 μg L −1 , respectively. The photocatalytic activity of the nanocomposite has been demonstrated by the photo degradation of Methylene Blue (MB) under solar irradiation.