Spectre of the Gun

For having trespassed on an alien world, Captain Kirk and his companions are forced to re-enact the shootout at the OK Corral.

Summary
On stardate 4385.3, the starship USS Enterprise, under the command of Captain James T. Kirk, is instructed to make peaceful contact with the Melkotians, the mysterious alien inhabitants of Theta Kiokis II, but is warned away by a strange space buoy that orders it not to proceed to the Melkotians' planet.

Ignoring the warning, Kirk takes the Enterprise to the planet anyway. Captain Kirk assembles a landing party consisting of himself, his first officer Mr. Spock, chief engineer Montgomery Scott, chief medical officer Dr. Leonard McCoy, and navigator Pavel Chekov and beams down to the surface of the planet to make contact. The Melkotians are angered by this and imprison the team in a psychic illusion that takes the form of the town of Tombstone, Arizona on Earth upon the historic date October 26, 1881.

The setting for the town is actually downloaded from Kirk's mind, but the Melkotians only had fragments of memories to work with; therefore the illusion has a surreal incompleteness to it – buildings are obvious façades, windows and pictures appear to float in mid air, doors open to nowhere, etc. The landing party also sees their equipment is changed; phaser turned into six-shooters, communicators and tricorders are missing, and there is no longer a way to make contact with the Enterprise.

Kirk and his companions quickly realize they are now impromptu characters in a bizarre reenactment of the legendary "shoot out at the O.K. Corral". Kirk and his team were playing the role of the infamous Cowboys; Kirk as Ike Clanton, Scotty as Billy Clanton, Bones as Tom McLaury, Spock as Frank McLaury, and Chekov as Billy Claiborne. They have to eventually face off the notorious lawman Wyatt Earp along with his brothers, Morgan and Virgil and their friend Doc Holliday. This was the team's punishment for trespassing and violating the Melkotian's strict privacy, a duel to the death, played out as one of the most famous historical events in the Wild West with the crew on the losing side.

They encounter the various inhabitants who treat them as their roles and cannot be persuaded otherwise. That is especially true for the Earps who are belligerently determined to kill them at the appointed hour, or sooner if they have an excuse. The crew try every means to prevent the fight, but nothing works. They are physically prevented leaving the town, the Earps cannot be pacified and the Sheriff refuses to interfere outside suggesting the unacceptable tactic of ambushing the Earps. The stakes rise further when Chekov is romanced by a local girl. She is harassed by an Earp who kills Chekov when he interferes. Yet for their loss, Kirk realizes that Chekov's character originally survived the gunfight, suggesting that the events can be changed around.

That glimmer of hope is dashed when an improvised knockout gas grenade they plan to use on their enemy totally fails on testing, thereby erasing their one possible advantage. Spock remarks that it should have worked, but the hour of the fight comes before he can explain his reasoning. When the crew refuses to go to the corral, they find themselves immediately teleported there and cannot escape.

The team fears for their lives, but Mr. Spock explains his realization. He notes that the gas bomb should have worked according to physical laws. Thus when it failed, the physical laws were disregarded and when that happens, reality does not exist. In short, Spock surmises that this whole scenario is not real, but actually an elaborate illusion occurring in the minds of the crew or to be more precise, it is only as real as their minds accept it to be.

While Spock's will is so strong that nothing can harm him, he has to convince the others of the same, but any lingering doubt will prove deadly since the mind will make it real. Kirk orders Spock to mind meld with each member of the team, in an attempt to wipe away any and all doubt from their minds that the bullets from the Earps' guns are mere phantasms, and will pass through their bodies without injury.

The shootout replays as history dictates, but when the Earps fire their pistols, their bullets have no effect as Spock predicted. Kirk tackles Wyatt Earp but does not kill him and tosses his gun to the ground. After the fight is over, the Melkots return Kirk and the rest of the landing party to the Enterprise, including Chekov, whose attraction to the girl clouded his perception of the false reality enough for him to survive.

A Melkot appears again on the bridge viewscreen and claims he is impressed that even though Kirk had the opportunity to kill the Earps, he chose instead to spare their lives. This act of mercy changes the Melkots' distrustful opinions of the Federation, and opens their doors to relations with them from then on.

Regulars

 * James T. Kirk (played by William Shatner)
 * Spock (played by Leonard Nimoy)
 * Leonard H. McCoy (played by DeForest Kelley)
 * Montgomery Scott (played by James Doohan)
 * Pavel Chekov (played by Walter Koenig)
 * Nyota Uhura (played by Nichelle Nichols)

Others

 * Wyatt Earp
 * Sylvia
 * Virgil Earp
 * Morgan Earp
 * Doc Holliday
 * Ed
 * Johnny Behan

Starships

 * USS Enterprise (NCC-1701) - Constitution-class