We extend the analysis presented by Contini et al. to higher redshifts, up to z = 2, by focusing on the relation between the intracluster light (ICL) fraction and the halo mass, its dependence on redshift, the role played by the halo concentration, and the formation time, in a large sample of simulated galaxy groups/clusters with
13
≲
log
(
M
halo
/
M
⊙
)
≲
15
. Moreover, a key focus is to isolate the relative contributions provided by the main channels for the ICL formation to the total amount. The ICL fraction at higher redshift is weakly dependent on halo mass and comparable with that at the present time, in agreement with recent observations. Stellar stripping, mergers, and preprocessing are the major channels responsible for the ICL formation, with stellar stripping accounting for ∼90% of the total ICL, regardless of halo mass and redshift. Preprocessing is an important process for clusters to accrete already formed ICL. The diffuse component forms very early, at z ∼ 0.6, and its formation depends on both concentration and formation time of the halo, with more concentrated haloes that formed early assembling their ICL earlier than those that formed later. The efficiency of this process is independent of halo mass but increases with decreasing redshift, which implies that stellar stripping becomes more important with time as the concentration increases. This highlights the link between the ICL and the dynamical state of a halo: groups/clusters that have a higher fraction of diffuse light are more concentrated, relaxed, and in an advanced stage of growth.