If you regularly read ‘how to write’ books you may have read warnings against having a Deus et machina ending. What is that? It is usually explained as a tradition in ancient Greek theater where the playwright could land the character in a load of trouble the playwright couldn’t fix, and then just use the ‘God from the machine,’ a stage device that made it look like a god-character had taken the troubled character up to heaven and solved all his problems.
Well. I’m skeptical. The little ancient Greek drama I have read is on mythological and legendary stories— stories the audience knew. They would not welcome a divine intervention that wasn’t part of the traditional story! The divine interventions in the stories was expected by the audience, in the same way modern Christian readers of the ‘Left Behind’ series of novels were not surprised by the Second Coming of Christ at the end which did solve the Antichrist problem. (I was not a Christian when I started reading them, but even I expected that ‘Second Coming’ event since book one.)
In your real-world writing life, Deus ex machina as a failed story ending is different from what we might imagine. It does not need to involve God or ‘the gods.’ It usually involves unexpected, surprise help from a powerful source— a king or president, a scientific discovery or a space-alien intervention, whatever.
The problem is not the powerful helper, but in the fact that it is unexpected and a surprise, and that also the main character did nothing to earn it. In our own real lives, we don’t have all our problems solved by a divine miracle or by a president making a visit to our town on our behalf. We usually have to work and suffer to try to fix our problems, and it may not work even then.
Also, real world instances that seem to be possible divine intervention— such as when God allowed the Blessed Mother to appear to Bernadette in Lourdes and the three shepherd children in Fatima— the divine intervention didn’t solve problems but caused them. The Fatima children were even taken to jail and threatened with being boiled alive!
The reason the true Deus ex machina is a bad story ending is that it makes things too easy for our lead character. We don’t enjoy following the adventures of characters that have it all so easy. We like the Harry Potters who are little babies when a major evil wizard tries to kill them, or the Katniss Everdeens who have to volunteer for what seems like certain death in the Hunger Games to save a vulnerable younger sister.
In Mercedes Lackey’s book, Aerie, there is what a cynic might describe as a literal Deus ex machina towards the end. Several Egyptian gods intervene so the main characters won’t be destroyed by an enemy army lead by a monster who was becoming a goddess. But that’s just at the end of the book. The main characters have to go through a lot of struggles and hard work to get to the point where the gods intervene. Mercedes Lackey, having published probably as many as 50 books by the time she wrote Aerie (part of The Dragon Jousters series which I highly recommend, at least to mature readers.) She is too good a writer to put in an actual Deus ex machina ending.
I once read a critique of ‘Christian fiction’ by someone who didn’t seem to have actually read any. He claimed that all Christian fiction has an ending in which a miracle from God solves everything. I have read quite a bit of Christian fiction, both evangelical and Catholic, and I’ve never read a book where a miracle solves anything. To see an example, read the ’Saint Tommy’ series by Catholic author Declan Finn. His character Tommy Nolan is a NYC cop who has been given by God some ‘wonder-working’ abilities like the ability to bilocate and to smell demonic evil. But that doesn’t fix his problems, but makes him a major target of both demon-possessed criminals and of progressive politicians.
In your own writing, you can keep from unintentionally writing a Deus ex machina by richly providing your Lead character with problems. Let him work on the problems with his own efforts. Let him suffer! If he does receive special help, whether divine or otherwise, don’t let that solve the problems for him. Yes, sometimes especially in Christian fiction a character may have to trust in the Lord for something instead of trying to fix it himself, but deciding to trust the Lord is also an action. And your character must act, not just be buffeted between helpful and oppositional forces.