I am trying to remember the name of a science fiction novel in the eighties that developed over three stages. Magicians summoned djinn or genies that were really technology from the past like tanks, nuclear bomb etc...
There was also a character who couldn't be attacked because damage directed at him was inflicted by him.