The ion production in an electron cyclotron resonance ion source (ECRIS) is modeled using a particlein-cell Monte-Carlo-collision code in a three-dimensional geometry. Only the heavy particles (ions and atoms) are tracked, while the electrons are represented using a Maxwell-Boltzmann energy distribution with the electron density determined from the requirement of quasineutrality, and the electron temperature considered as a free parameter. It is found that experimentally observed features of ECRIS plasma are closely reproduced by the code, including the charge-state distributions of extracted ion beams and sputtering patterns inside the source. The isotope anomaly is observed for the mixture of 20 Ne þ 22 Ne isotopes, and a possible explanation is proposed. Finally, the wall-coating effect is treated by modeling the neutralization of ions impinging on the walls of the plasma chamber.