The structure of the work is simple, but effective: an unnamed country goes to war, and patriotic citizens attend a church service for soldiers who have been called up. The people call upon their God to grant them victory and protect their troops. Suddenly, an "aged stranger" appears and announces that he is God's messenger. He explains to them that he is there to speak aloud the second part of their prayer for victory, the part which they have implicitly wished for but have not spoken aloud themselves: the prayer for the suffering and destruction of their enemies. What follows is a grisly depiction of hardships inflicted on war-torn nations by their conquerors. The story ends on a pessimistic note: the messenger is ignored.
The piece was left unpublished by Mark Twain at his death, largely due to pressure from his family, who feared that the story would be considered sacrilegious. Twain's publisher and other friends also discouraged him from publishing it. According to one account, his illustrator Dan Beard asked him if he would publish it regardless, and Twain replied that "Only dead men can tell the truth in this world. It can be published after I am dead." Mindful of public reaction, he considered that he had a family to support, and did not want to be seen as a lunatic or fanatic. In a letter to his confidant Joseph Twichell, he wrote that he had "suppressed" the book for seven years, even though his conscience told him to publish it, because he was not "equal" to the task.
The War Prayer wasn't published until six years after Twain's death, in unusual circumstances. World War I had broken out more than two years previously, and in that time had produced unprecedented casualties on both sides, yet with the U.S. still officially neutral, and President Wilson running for re-election on the slogan He Kept Us Out of War. Twain's story appeared in Harper's Monthly, November 1916. Had the attempt been made to publish it five months later, in April 1917, it might ironically have been seen as too unpatriotic for print.