I am remembering parts of a movie in which shelling from a war woke an old alien machine. The machine turned humans into soldiers for itself. The machine was defeated when a jaded religious man used a broken sword as a key to initiate the machines takeoff sequence.
“Mutant Chronicles” (2008)
If you think that this is the movie you are looking for, then please select my answer as Best Answer by clicking on the “Select” button.
In this clip from the movie you can see the man using the sword to initiate the take-off sequence: