We present a new backward evolution model for galaxies and AGNs in the infrared (IR). What is new in this model is the separate study of the evolutionary properties of the different IR populations (i.e. spiral galaxies, starburst galaxies, low-luminosity AGNs, unobscured type 1 AGNs and obscured type 2 AGNs) defined through a detailed analysis of the spectral energy distributions (SEDs) of large samples of IR selected sources. The evolutionary parameters have been constrained by means of all the available observables from surveys in the mid- and far-IR (source counts, redshift and luminosity distributions, luminosity functions). By decomposing the SEDs representative of the three AGN classes into three distinct components (a stellar component emitting most of its power in the optical/near-IR, an AGN component due to hot dust heated by the central black hole peaking in the mid-IR, and a starburst component dominating the far-IR spectrum) we have disentangled the AGN contribution to the monochromatic and total IR luminosity emitted by the different populations considered in our model from that due to star-formation activity. We have then obtained an estimate of the total IR luminosity density (and star-formation density - SFD - produced by IR galaxies) and the first ever estimate of the black hole mass accretion density (BHAR) from the IR. The derived evolution of the BHAR is in agreement with estimates from X-rays, though the BHAR values we derive from IR are slightly higher than the X-ray ones. Finally, we have simulated source counts, redshift distributions and SFD and BHAR that we expect to obtain with the future cosmological Surveys in the mid-/far-IR that will be performed with JWST-MIRI and SPICA-SAFARI.