Evidence of a critical Mn−Mn distance for the onset of ferromagnetism in NiAs type compounds