  We combine a N-body simulation algorithm with a subgrid treatment of galaxy
formation, mergers, and tidal destruction, and an observed conditional
luminosity function Phi(L|M), to study the origin and evolution of galactic and
extragalactic light inside a cosmological volume of size (100 Mpc)^3, in a
concordance LCDM model. This algorithm simulates the growth of large-scale
structures and the formation of clusters, the evolution of the galaxy
population in clusters, the destruction of galaxies by mergers and tides, and
the evolution of the intracluster light. We find that destruction of galaxies
by mergers dominates over destruction by tides by about an order of magnitude
at all redshifts. However, tidal destruction is sufficient to produce
intracluster light fractions f_ICL that are sufficiently high to match
observations. The bulk of the intracluster light (60%) is provided by
intermediate galaxies of total masses 10^11 Msun-10^12 Msun and stellar masses
6x10^8 Msun-3x10^10 Msun that were tidally destroyed by even more massive
galaxies. The contribution of low-mass galaxies to the intracluster light is
small and the contribution of dwarf galaxies is negligible, even though, by
numbers, most galaxies that are tidally destroyed are dwarfs. Tracking clusters
back in time, we find that their values of f_ICL tend to increase over time,
but can experience sudden changes that are sometimes non-monotonic. These
changes occur during major mergers involving clusters of comparable masses but
very different intracluster luminosities. Most of the tidal destruction events
take place in the central regions of clusters. As a result, the intracluster
light is more centrally concentrated than the galactic light. Our results
support tidal destruction of intermediate-mass galaxies as a plausible scenario
for the origin of the intracluster light.
