What is the dues ex machina

Dues ex machina, which is Latin for "god from the machine," refers to a narrative device used in storytelling. It involves the unexpected and often contrived intervention of a divine or supernatural being, object, or event to resolve or untangle a difficult situation or plot. This intervention occurs suddenly and without prior development, sometimes appearing as if from nowhere, to conveniently resolve conflicts or save characters from dire consequences. It is often criticized for being a lazy or unsatisfying way to conclude a story, as it can undermine tension, character development, and logical consistency.