Synoptic Gospels
The story appears in the three Synoptic Gospels, but not the Gospel of John. All accounts involve Jesus exorcising demons, identified collectively in Mark and Luke as "Legion".