The Prayer to Saint Michael the Archangel is the result of a mystical vision of Pope Leo XIII sometime between 1884 and 1886. When he had just finished celebrating Mass, he had a vision in which he saw demons gathering in Rome and heard the devil boasting that he could destroy the Church and demanded sufficient time to do so.
When Pope Leo came out of his mystical vision, he immediately went to his desk and wrote down what we now know as the Prayer to St. Michael the Archangel. He decreed that it should be said at every daily Mass offered in the Catholic Church throughout the world as a response to the demonic agenda of Satan and his minions. The Church greatly encourages the faithful to pray this prayer as a protection from spiritual evil in our world.
Saint Michael Archangel, defend us in battle,
be our protection against the wickedness and snares of the devil;
may God rebuke him, we humbly pray;
and do thou, O Prince of the heavenly host,
by the power of God, cast into hell Satan and all the evil spirits
who prowl about the world seeking the ruin of souls. Amen.