  We report on a quantitative analysis of the magnetic field generated by a
continuous current running in metallic micro-wires fabricated on an
electrically insulating diamond substrate. A layer of nitrogen-vacancy (NV)
centres engineered near the diamond surface is employed to obtain spatial maps
of the vector magnetic field, by measuring Zeeman shifts through
optically-detected magnetic resonance spectroscopy. The in-plane magnetic field
(i.e. parallel to the diamond surface) is found to be significantly weaker than
predicted, while the out-of-plane field also exhibits an unexpected modulation.
We show that the measured magnetic field is incompatible with Ampere's
circuital law or Gauss's law for magnetism when we assume that the current is
confined to the metal, independent of the details of the current density. This
result was reproduced in several diamond samples, with a measured deviation
from Ampere's law by as much as 94(6)\%. To resolve this apparent magnetic
anomaly, we introduce a generalised description whereby the current is allowed
to flow both above the NV sensing layer (including in the metallic wire) and
below the NV layer (i.e. in the diamond). Inversion of the Biot-Savart law
within this two-channel description leads to a unique solution for the two
current densities, which completely explains the data, is consistent with the
laws of classical electrodynamics and indicates a total NV-measured current
that closely matches the electrically-measured current. However, this
description also leads to the surprising conclusion that in certain
circumstances the majority of the current appears to flow in the diamond
substrate rather than in the metallic wire, and to spread laterally in the
diamond by several micrometres away from the wire. No electrical conduction was
observed between nearby test wires, ruling out a conventional conductivity
effect. [...]
