We consider a branching model for a population of dividing cells infected by parasites. Each cell receives parasites by inheritance from its mother cell and independent contamination from outside the cell population. Parasites multiply randomly inside the cell and are shared randomly between the two daughter cells when the cell divides. The law governing the number of parasites which contaminate a given cell depends only on whether the cell is already infected or not. We first determine the asymptotic behavior of branching processes in a random environment with state-dependent immigration, which gives the convergence in distribution of the number of parasites in a cell line. We then derive a law of large numbers for the asymptotic proportions of cells with a given number of parasites. The main tools are branching processes in a random environment and laws of large numbers for a Markov tree.