Serial endosymbiosis.
Plastids (pigment-bearing organelles such as chloroplasts)
evolved from a cyanobacterium
that was engulfed by a heterotrophic eukaryote
(primary endosymbiosis).
That ancestral eukaryote diversified into
red algae
and
green algae,
some of which were subsequently engulfed by other eukaryotes (secondary endosymbiosis);
these plastids may retain their own nucleus.