Its not a purely American invention, as it has a parallel in Spanish: Nos Confiamos en el Dios, but neither was the motto In God We Trust merely a creation of the Cold War by any stretch of the imagination either, as some like to argue dishonestly as part of a hope that some day it will go away as the national motto. Any Court can read this following paragraph, and laugh out loud at the evangelical church-State separationists idea that there is anything slightly problematic whatsoever as to the motto:
Oh! thus be it ever, when freemen shall stand
Between their loved home and the war's desolation!
Blest with victory and peace, may the heav'n rescued land
Praise the Power that hath made and preserved us a nation.
Then conquer we must, when our cause it is just,
And this be our motto: "In God is our trust."
And the star-spangled banner in triumph shall wave
O'er the land of the free and the home of the brave!