Captain Kirk leads a survey mission to a peaceful, primitive planet which he visited 13 years before as a lieutenant. He is dismayed to see a group of villagers armed with flintlocks, weapons they shouldn't have at their current stage of development. The villagers ambush the landing party and wound Spock. Returning to the U.S.S. Enterprise, Spock is put under the care of Dr. M'Benga, who once interned in a Vulcan ward. M'Benga tells McCoy they've done all they can for Spock, and that he has to recover on his own.
Meanwhile, a Klingon vessel is detected in orbit around the planet, and Kirk orders Chekov to keep the Enterprise out of sensor range while he returns to the surface. He'll be looking for Tyree, the tribal leader he befriended years earlier. Minutes after Kirk and McCoy beam down in native clothing, they are attacked by a mugato, a white apelike creature with poisonous fangs, who bites Kirk before McCoy can kill it with a phaser. They can't return to the Enterprise, so Kirk tells McCoy that Tyree's people have a cure for the mugato poison.
Some hill people find Kirk and McCoy and take them to their caves, informing them that Tyree is now their leader, and his wife, Nona, knows how to help Kirk. But Tyree and Nona are currently on a scouting mission. Nona is using drugs to keep Tyree devoted to her, and she urges him to acquire "firesticks" for their people, but being a devoted pacifist, he refuses. Informed about Kirk, Nona heads back to the caves, where she sees McCoy using his phaser to heat some rocks. Nona is intrigued, and wants to know more about their guests. Nona treats Kirk by cutting her hand and pressing a mahko root against Kirk's wound. She collapses but Kirk recovers. Now, according to legend, Kirk will be unable to refuse Nona anything.
Meanwhile, on the Enterprise, Dr. M'Benga has informed Nurse Chapel that Spock is in a state of self-induced hypnosis to heal his own injuries. When Spock's readings fluctuate, M'Benga is pleased, and tells Chapel that if Spock regains consciousness she is to do whatever the Vulcan asks.
Tyree tells Kirk and McCoy that the firesticks first appeared nearly a year ago, but assumes the villagers have been making them — he hasn't seen any strangers. Kirk asks him to take them to the village under cover of dark. Nona joins them and implores Kirk to help make Tyree a powerful man, but the captain says he will not interfere.
Tyree leads Kirk and McCoy into the village, where they find a forge containing clear evidence that Klingons are involved. They watch in hiding as the villager's leader, Apella, enters with a Klingon. Kirk and McCoy overpower them, take a flintlock and escape with Tyree's help.
Spock regains partial consciousness and demands that Chapel strike him. She does so hesitantly at first, but at Spock's insistence she slaps him harder and harder, until Scotty walks in and stops her, not knowing he's endangering Spock by doing this. M'Benga finds out what's happening, rushes over and slaps Spock violently until he is fully conscious. Spock thanks him for bringing him out of his hypnotic state.
On the planet, Kirk teaches Tyree and his people how to fire the stolen flintlock. McCoy points out that he is corrupting the hill people's society, but Kirk replies that the Klingons left them no choice — in order to bring equity back between the hill people and the villagers, he has to provide equal weapons. McCoy is horrified, but has no alternative solution. Realizing Tyree is hesitant to arm his people, Kirk hopes that Nona can convince her husband to fight. When he approaches her, she uses the same drug on him that she used to seduce Tyree. Kirk falls under her spell. Tyree sees what's happening and aims the flintlock at his wife, but he cannot bring himself to shoot. He throws the weapon away in disgust and walks off.
Suddenly, a mugato attacks Kirk and Nona. After a struggle, Kirk is forced to destroy the creature with his phaser. Seeing her opportunity, Nona knocks Kirk out and takes the phaser. Tyree and McCoy find Kirk and revive him, while Nona runs into a patrol of villagers and offers them victory by using Kirk's phaser. But the villagers attack and kill her. Tyree and Kirk rush in and overpower the villagers. When Tyree learns that Nona is dead he takes up the rifle and tells Kirk he needs more weapons. McCoy retrieves Kirk's phaser, and Spock contacts them from the ship. Kirk orders Scotty to manufacture a hundred flintlocks — they are making serpents for the Garden of Eden.