Thank you all for the replies. This will help a lot for my prep.
I didn't mean to be intentionally dodgy on the classes for the NPCs; I just hadn't decided for myself who they are going to be yet. As to level they are all going to be level 14-18.
The gate is a modified gate spell - it gates in a demon (most likely, or something else similarly evil) which is defined as "uncontrolled" but is also tied to 1000 feet of the gate spot for 5 minutes, after which (if it is still alive) it can leave the plane. So it can't be teleported from it's gate point.
Backstory (long, feel free to ignore or skip if you get bored, but I thought I would provide some context):
This all started from two conversations with my players.
The first one was "How can it be in 40,000 years of human existance that people haven't come up with more innovation?" I already had an answer to this, but I had no real way to convey the answer to the player (and I didn't want to give him meta-game knowledge).
The second one was from a player who was interested in building a castle. He looked at his spell list and said, "This is ridiculous. Castles just don't work when magic is involved. Castle wall? Disintigrate. Teleport. Transmute rock to mud. There are so many things magic can do that traditional castles can't defend against."
And I had to agree with him. Some of the magical offense can be countered with magic items or other spells, but the cost of outfitting such a castle would be tremendous.
Out of these two conversations, I came up with my idea.
"With great power comes great responsibility." Thank you spider man. Wizards and clerics using their spells to their utmost and irresponsibly would result in the destruction of mankind through mutally assured destruction.
Therefore, upon attaining the 5th circle of spells, each spellcaster had to pledge to the body of high level spellcasters that they would not allow themselves to be hired out to perform offensive acts. Personal vengeance or avenging a friend was permitted, but a lord would not be able to hire 5 wizards capable of casting 8th circle spells to war upon his neighbor. He would, however, be allowed to hire 5 wizards to defend his castle, as a deterrent to anyone attacking him (sort of like nuclear missiles).
Anyone not agreeing was permitted to eschew the use of 5th circle spells and above forever and remain a mercenary. The body of high level spell casters would eliminate anyone who did perform an offensive high level spell for profit.
OK, well that was good and all and would explain why kingdoms can live in relative peace... but that is totally unreasonable and unrealistic. There is no way that this covenent could have become established; no way for people to enforce it originally, or for that matter, for anyone who originally thought it was a good idea to get enough buy-in to make it happen.
Given that this pact could not have been created, and given that humans were human, I saw only one recourse. There originally was no pact, and humans eventually almost totally destroyed themselves.
My characters have already had a chance to experience historical events, though they aren't sure exactly how or why.
So I decided that about 25,000 years ago, humans almost destroyed themselves. Humans had risen to a very powerful level. They had innovated, come up with magical answers to many problems. Eventually people lived a long time (since magic cured their ailments) and didn't need to work to a large extent (since magic created food / water and did other innovations).
Given this idleness and manifestation of magic, people grew restless and wanted territory. Leaders would hire legions of wizards, and they could destroy scores of troops with each spell. Leaders starting needing to capture more territory to attract powerful clerics and wizards. The peasents were throw-away. They didn't need to work the fields or do any of the labor that magic had solved, so they were all conscripted and sent off to fight. And they died. In the tens of thousands. They were no match for the powerful magic of the spell casters.
Eventually they ran out of everyone low level they could find. Some humans escaped into remote locations, but most had either been conscripted and sent off to die, or killed by wizards who would teleport next to a town and destroy it entirely in a few minutes.
Powerful people congregated into powerful castles which had sufficient magical defenses to prevent the scry-buff-teleport method from assassinations, and also had enough magical defenses to prevent most other methods of infiltration.
By this time there were perhaps 5000 or so humans left (remember magic took care of all their infrastructure needs), all high level -- survival of the fittest. The leaders decided they needed more power. They began to experiment in creating undead (there were many dead humans -- if they could be re-raised, that would be a huge army) and gating in demons.
Eventually they were able to succeed with both.
The party will pop into a time where humans have just discovered how to gate in demons. Human life is at a premium. It has largely come down to a war of attrition, and every side hopes that the demons will kill off enough of the enemy that eventually they won't be able to perform upkeep of the magical defenses of the castles, after which they will be ripe for overrunning in a traditional magical way.
What the humans of their time don't realize of course, or perhaps just don't want to think about, is that as they summon in more and more powerful demons, eventually some are going to break free.
In the end, the demons turned on the humans and destroyed almost all of them. Luckily for them, there had been another reclusive and isolationist race of powerful creatures (called belar). Once they saw the demons grow in power (the demons were able to gate in their brethren so they quickly multiplied), they stepped in and started fighting them. It took several thousand years to fully excise them, but eventually they belar were able to succeed.
During this time, humans had been reduced to little more than animals. The only humans to survive were the ones who hid in caves or other remote places. The belar intially dismissed the humans, believing that they would probably die out. But humans were tenacious and began to reappear and rebuild.
It was then that the belar realized that history would repeat itself if they didn't interfere. So they helped nurture the humans back to civilization, but also guided them and instilled in them their own potential for self-destruction.
Taking a mentor role, they discouraged certain magical innovations to occur, and also encouraged the formation of the self-protection pact (the pact mentioned at the beginning of the backstory) to help prevent another armegeddon.
So this scenario helped answer two of my players' questions. And now the PCs are stuck in history right before the start of the demon wars. Will they be able to do anything about it? Why are they there? Who knows... I guess we'll all find out!