Where does the phrase “a god from a machine” originate and What does deus ex machina mean?

The Latin phrase “deus ex machina” really refers to a stage effect in Greek plays.

That is to say, Greek tragic playwrights frequently introduced one or another of the gods for the purpose of explaining some situation or solving some difficulty.

Representing gods, the characters who played the parts could not walk out upon the stage as did other players, but were let down upon the stage from above by the aid of a mechanical device constructed for the purpose.

Such was a god from a machine, deus ex machina, one who appeared suddenly and unexpectedly, ready to solve any difficulty.