Mark 9:38-40 (ESV):
38 John said to him, “Teacher, we saw someone casting out demons in your name, and we tried to stop him, because he was not following us.” 39 But Jesus said, “Do not stop him, for no one who does a mighty work in my name will be able soon afterward to speak evil of me. 40 For the one who is not against us is for us.
vs.
Acts 19:11-16 (ESV):
11 And God was doing extraordinary miracles by the hands of Paul, 12 so that even handkerchiefs or aprons that had touched his skin were carried away to the sick, and their diseases left them and the evil spirits came out of them. 13 Then some of the itinerant Jewish exorcists undertook to invoke the name of the Lord Jesus over those who had evil spirits, saying, “I adjure you by the Jesus whom Paul proclaims.” 14 Seven sons of a Jewish high priest named Sceva were doing this. 15 But the evil spirit answered them, “Jesus I know, and Paul I recognize, but who are you?” 16 And the man in whom was the evil spirit leaped on them, mastered all of them and overpowered them, so that they fled out of that house naked and wounded.
Can non-disciples of Jesus cast out demons in Jesus' name? Mark 9:38-40 appears to say "yes" but Acts 19:11-16 appears to say "no". Does the answer depend on the particular conditions of each situation?
Related: If a "house divided cannot stand" how did non-disciples cast out demons?