First, "In God We Trust" didn't appear until about 80 years or so after the Declaration of Independence was signed. As for a poorly organized militia defeating the Royal British Empire...it didn't. A fairly small English army got tired of messing with the locals after defeating them in battle after battle and said, "To hell with it, we're going home."

By the way, the Confederate states were certain, absolutely certain that God was firmly on their side. Guess they weren't so lucky.