  We use density functional theory to explore the possibility of making the
semiconducting transition-metal dichalcogenide MoS$_2$ ferromagnetic by
introducing holes into the narrow Mo $d$ band that forms the top of the valence
band. In the single impurity limit, the repulsive Coulomb potential of an
acceptor atom and intervalley scattering lead to a twofold orbitally degenerate
effective-mass like $e'$ state being formed from Mo $d_{x^2-y^2}$ and $d_{xy}$
states, bound to the K and K$'$ valence band maxima. It also leads to a singly
degenerate $a'_1$ state with Mo $d_{3z^2-r^2}$ character bound to the slightly
lower lying valence band maximum at $\Gamma$. Within the accuracy of our
calculations, these $e'$ and $a'_1$ states are degenerate for MoS$_2$ and
accommodate the hole that polarizes fully in the local spin density
approximation in the impurity limit. With spin-orbit coupling included, we find
a single ion magnetic anisotropy of $\sim 5\,$meV favouring out-of-plane
orientation of the magnetic moment. Pairs of such hole states introduced by V,
Nb or Ta doping are found to couple ferromagnetically unless the dopant atoms
are too close in which case the magnetic moments are quenched by the formation
of spin singlets. Combining these exchange interactions with Monte Carlo
calculations allows us to estimate ordering temperatures as a function of the
dopant concentration $x$. For $x \sim 9\%$, Curie temperatures as high as 100K
for Nb and Ta and in excess of 160K for V doping are predicted. Factors
limiting the ordering temperature are identified and suggestions made to
circumvent these limitations.
