We present a comprehensive study of the electronic, magnetic, and optical properties of CuGa1−xFexS2, as a promising candidate for intermediate-band (IB) solar cells. We use hybrid exchange-correlation functional within the density functional theory framework, and show that Fe doping induces unoccupied states 1.6-1.9 eV above the valence band. The IBs significantly enhance the optical absorption in lower energy part of the spectrum. We find that at moderate n-type codoping concentration, the added charge occupies part of the IB in the gap, but large concentrations lower the energy of the occupied IB toward the valence band. Moreover, we show that Fe impurities tend to cluster within the compound and they choose antiferromagnetic ordering. The findings can have a significant effect in understanding this material and help to synthesize more efficient IB solar cells.