The U.S.S. Enterprise finds a crewless starship, the U.S.S. Exeter, in orbit around the planet Omega IV. The boarding party from the U.S.S. Enterprise contracts a virus that may have killed the Exeter's crew, but the biosphere on Omega IV is found to contain an immunity. The party is beamed to the surface.
There they discover Captain Tracey, the commander of the U.S.S. Exeter. He has been violating the Federation's Prime Directive by interfering in the politics of the natives, using his phaser to protect the asian-like villagers, the Kohms, against the barbarian raiders, the Yangs. Tracey demands that Kirk supply him with more phasers, which Kirk refuses to do.
The Yangs capture the Kohms village and the U.S.S. Enterprise crew learns that these people are possibly descendants of Earth's Communist Chinese who left Earth in the last years of the 20th Century. The Yangs mouth a distorted version of the United States Constitution, which are their 'holy words' and which Kirk recites, gaining their confidence. Prolonged exposure to the planet's atmosphere cures the landing party and, with Captain Tracey under arrest, they return to the U.S.S. Enterprise.