We give a gauge-independent definition of magnetic monopoles in the SU (N ) Yang-Mills theory through the Wilson loop operator. For this purpose, we give an explicit proof of the DiakonovPetrov version of the non-Abelian Stokes theorem for the Wilson loop operator in an arbitrary representation of the SU (N ) gauge group to derive a new form for the non-Abelian Stokes theorem. The new form is used to extract the magnetic-monopole contribution to the Wilson loop operator in a gauge-invariant way, which enables us to discuss confinement of quarks in any representation from the viewpoint of the dual superconductor vacuum.