This episode is a narration of the 50th Sutta of the Middle Discourses of the Buddha, The Māratajjanīya Sutta, which is about the time when Māra, the trickster and god of death, tried to annoy Moggallāna. He not only failed but was subject to a stern sermon warning of the dangers of attacking the Buddha’s disciples.
This translation of the Maratajjaniya Sutta is by Bhikkhu Sujato and was sourced from Sutta Central.