Geometrical and topological properties of three-dimensional, divergence-free vector fields are investigated, with an emphasis on the integrability of the field-line trajectories. The sufficient condition for the integrability of three-dimensional and topologically nontrivial vector fields is derived. The derivation is based on a variational principle, which is analogous to the Hamilton's principle for the classical mechanics of particle dynamics. This formulation can potentially be extended to investigations on the quantum effects of particle dynamics in a complex magnetic field within the framework elf the semi-classical quantization.