  We study the generation of strong large scale magnetic fields in compact
stars containing degenerate quark matter with unbroken chiral symmetry. The
magnetic field growth is owing to the magnetic field instability driven by the
electroweak interaction of quarks. In this system we predict the enhancement of
the seed magnetic field $10^{12}\,\text{G}$ to the strengths
$(10^{14}-10^{15})\,\text{G}$. In our analysis we use the typical parameters of
the quark matter in the core of a hybrid star or in a quark star. We also apply
of the obtained results to model the generation of magnetic fields in
magnetars.
