The inverse problem of magnetoencephalography (MEG) seeks the neuronal current within the conductive brain that generates a measured magnetic flux in the exterior of the brain-head system. This problem does not have a unique solution, and in particular, it is not even possible to identify the support of the current if it extends over a three-dimensional set. However, a localized current supported on a zero-, one- or two-dimensional set can in principle be identified. In the present work, we demonstrate an analytic algorithm that is able to recover a one-dimensional distribution of current from the knowledge of the exterior magnetic flux field. In particular, we consider a neuronal current that is supported on a small line segment of arbitrary location and orientation in space, and we reduce the identification of its characteristics to a nonlinear algebraic system. A series of numerical tests show that this system has a unique real solution. A special case is easily solved via the use of trivial algebraic operations.