Stardate 3192.1: The Enterprise is en route to Eminiar 7 to make diplomatic contact with the planet locals. They're warned away and the chief diplomat, Ambassador Fox, orders Kirk to go in anyway so they can establish a treaty port.
They establish orbit and Spock notes that the Eminiar have space flight and are in contact with their neighboring planet. The starship that contacted the planet disappeared 50 years ago. Kirk plans to go down without Fox, refusing to take him down until it's safe. Kirk takes down Spock, a yeoman, and two security guards. Spock notes that there's no indication they've been discovered. They arrive at a central facility and greeted by Mea 3, who says they are in danger and takes them to the Eminiar High Council and their leader, Anan 7. Anan 7 says they are at war and have been for 500 years. He warns the Enterprise is in danger as long as they remain, and they are at war with their former colony, Vendikar.
Anan 7 receives word of an attack and goes into a war center in the next room. Mea 3 explains that there are frequent attacks and they will retaliate. The screens note a nearby hit but Kirk and Spock detect nothing. The screens show a hit on the Enterprise and Anan 7 calls in a security detachment as he tells Kirk their ship has been destroyed. Spock concludes that the war is waged by computer and Anan 7 explains that they have determined a way to conduct a "peaceful" war to avoid the devastation to the planets' infrastructure. The "victims" then march into disintegration machines to fulfill their duties. Anan 7 tells the landing party the Enterprise was a legitimate target and registered "destroyed" by the computers. The crew has 24 hours to report to the disintegration machines, and Anan 7 holds the landing party as hostages to force the crew to surrender.
Mea 3 visits Kirk in his quarters and informs him that she is also a fatality and will be reporting to the disintegration chambers. Meanwhile, Anan 7 tries to have Scotty beam down the crew by impersonating Kirk's voice electronically. Scott confirms the broadcast is a fake.
Back on the planet, Kirk has Spock use his telepathic abilities to reach out to the guard outside and lure him in. They knock him out, take his weapon, and the landing party heads out to find more weapons. They find a disintegration chamber and spot Mea 3 going in. They stop her, clear away the people awaiting disintegration, and destroy the machine. Anan 7 orders security team to find the landing party and opens fire on the Enterprise. Fortunately, Scotty has put the shields up but Fox overrides him before he can open fire on Eminiar.
The landing party returns to their confinement chamber but Mea 3 refuses to cooperate when Kirk insists on stopping the killing. In orbit, Fox establishes contact with Anan 7, who claims the attack was an error. Anan 7 cuts off the disintegrator beams and invites Fox down, but tells his people top open fire as soon as the shields are down. Scotty refuses despite Fox's authority, and the ambassador leaves the bridge in a fury.
Kirk sneaks into Anan 7's quarters but the leader is unconcerned and offers him a drink. Anan 7 secretly signals for his security team while Kirk talks about how he and his people conduct real war. Anan 7 finally tells him the communicators are in the war room and Kirk goes outside… but throws Anan 7 into the guards outside. They manage to overwhelm him.
Fox and his aide beam down to the planet where Anan 7 informs him he is a casualty of war and will be taken to a disintegration chamber. Meanwhile, Spock has jury rigged a communicator and contacts Scotty, telling him not to drop the screens. Upon learning that Fox is on the planet, Spock and the disguised security guards rescue Fox and destroy the disintegration chamber. Fox tells Spock that Kirk is in the war chamber, and offers to help.
Anan 7 tries to get through to Kirk, insisting that real war may break out. When Kirk refuses to cooperate, Anan 7 calls the Enterprise and Kirk orders them to take General Order 24. Anan 7 gives them 30 minutes to start beaming down the crew. Kirk notes that under General Order 24, Scotty will destroy the planet in two hours. The ship has moved out of range and Vendikar warns they will launch a real attack if the fatality quotas aren't met. Kirk manages to grab a disruptor pistol, just as Spock arrives with the others. They go into the war room and destroy the computers, breaking off contact with Vendikar. Kirk suggests that Anan 7 start preparing his people for real war since Vendikar will launch nuclear attack. Or… Anan 7 can try negotiating peace. Anan 7 agrees, using an old radio channel and with Ambassador Fox providing assistance. Kirk cancels General Order 24 and beam up.
Back on the Enterprise, Fox reports things are looking hopeful. Kirk notes that he figured real war couldn't be any more devastating then the "virtual" war between the two planets, and admits he based his actions on a feeling.