UPDATE: Ralph Luker left a helpful comment, which I'll put here so that it doesn't eventually get deleted when HaloScan gets rid of it:
Right. H. G. Wells went through some changes. God the Invisible King represents the high tide of his theism and its emergence can be tracked in the work immediately preceding it. I suspect that the theism, which is neither identifiable with Christianity nor particularly hostile to it, had something to do with the spiritual crisis felt by many western intellectuals in the World War I era. In Wells's case, that theism began to ebb soon thereafter and he participates fully in, becomes a major spokesman for, the secularism of the inter-war years.