Spectre of the Gun (episode)
Captain Kirk, Mr. Spock, Dr. McCoy, Scotty, and Chekov are forced to re-enact the gunfight at the O.K. Corral in Tombstone as the team that lost the gunfight.

Summary

Teaser
On a mission on behalf of the Federation to establish contact with the reclusive and xenophobic Melkotians, Captain Kirk decides to ignore the message of a space buoy warning the  to immediately withdraw from Melkotian space and go back the way it came. Kirk hears the warning in English, but Spock, Chekov and Uhura hear it in Vulcan, Russian, and Swahili; their native languages, respectively. This leads the crew to deduce the message was transmitted telepathically. Kirk orders Uhura to further contact the Melkotians, but there is no response to his hails. 

When Spock, Kirk, Scott, Doctor McCoy, and Ensign Chekov beam down to the Melkotian planet, they materialize in a fog bank not recorded by sensors. Their tricorders and communicators do not function. The landing party encounters a Melkotian. The Melkotian emerges from the fog and tells the Enterprise officers that their warning was plain, they have disregarded it, and will now be punished.

Act One
The Melkotian informs them that they are "outside" – a disease that must be destroyed. They learn that their trespassing is to be punished by death and how they will die will be taken from Kirk's mind, since it was he who ordered that the Melkotians' warning be disregarded. The Malkotian tells Kirk that "yours shall be the pattern of your death."

The landing party suddenly finds itself teleported to a facade of a 19th century American frontier town. All of their equipment is gone, and instead each now has a gunbelt and a revolver. They observe the curious "incompleteness" of the town. Buildings with only a front wall, open to the air on the sides and back, signs and clocks hanging in mid-air. Kirk reads from a copy of the Tombstone Epitaph, a newspaper with the date of October 26th, 1881. Kirk wonders "Why here? And why now?". Spock notes that the time and place is based on the patterns of Kirk's memories. A man with a sheriff's badge greets them, acting as though he knew them well. He refers to Kirk as Ike, Spock as Frank, Scott as Billy, and McCoy as Tom. Recognizing the sheriff's name, Johnny Behan, Kirk quickly puts the names together. Ike Clanton, Frank McLowery, Tom McLowery, William Claiborne and Billy Clanton. He further recalls that the Clantons were one of the factions who fought for control of the town of Tombstone; the other being the Earps: Wyatt, Morgan, and Virgil, who were the town marshals, as well as "Doc" Holliday. Spock notes that the famous gunfight of O.K. Corral took place on October 26, 1881 and that the Clantons lost. Kirk warns that the antique guns they all are carrying can be as deadly as phasers at close range.

They witness the shooting of a bar patron by Morgan Earp, and conclude that death is one thing that is real in this surreal scenario. Inside the bar, Chekov is accosted by a woman named  who claims to know him as Billy. Kirk recognizes Morgan as the man who kills on sight, and rises to confront him. Spock cautions him to back down, without moving a muscle, as he would be quickly gunned down in a "fast draw." Kirk says he does not want any trouble from Earp, but Earp says he will get them to draw soon enough, and then leaves. 

Kirk and Spock discuss what is expected to happen based on history, that they are supposed to be killed at the OK Corral at 5 pm. Kirk says that they will not be there. Kirk tries to convince Ed the bartender vehemently that he is not Ike Clanton, that he and his group are from the future, Kirk is the captain of a starship, but to no avail. The bartender tells him it makes no difference who he thinks he his, but rather whom the Earps think he is, while walking away still laughing.

Kirk then attempts to make peace with the Earps, saying there is a mistake. Virgil Earp says that he always felt the Clantons were "yellow" and then hits Kirk. Kirk strikes him back, Wyatt Earp then draws on Kirk, but Virgil stops him. Wyatt Earp warns Kirk that if he is in town at 5:01pm, the Earps will kill them.

Act Two
Kirk returns to the bar, and discusses what options they have with Spock, McCoy and Scotty. Kirk and the landing party try to leave town, but they are stopped by a force field. Spock notes that the Melkotians will not allow them to leave. Recognizing that they must fight, Kirk asks if they can find some way to stop the Earps using materials at hand in this recreation of Tombstone. McCoy and Spock cooperate to build a tranquilizer gas grenade which will incapacitate the Earps. McCoy encounters the town dentist, "Doc" Holliday, while acquiring the chemicals needed for the tranquilizer, asking to borrow a small quantity for a serious emergency. Holliday tells McCoy that his "emergency sure is real," and lets him take the chemical, but warns him to be finished by 5:00pm, because at "one minute past five, you'll find a hole in your head."

Meanwhile, Chekov has fallen in love with Sylvia, telling her that he is looking forward eagerly to the dance next week. Sylvia asks if they can turn the dance into a wedding ball, but Chekov says that would not be possible, because he is not someone she could marry. The two share a passionate kiss, but then Morgan Earp appears and knocks Chekov down, and starts to walk Sylvia away. When Chekov gets up and tells Morgan to get his hands off of her, Chekov draws for his gun, then he is shot and killed by Morgan. Kirk, Spock, McCoy, and Scotty appear as do the Earps. McCoy examines Chekov and tells Kirk that there is nothing he can do. Wyatt tells Kirk to "do it now," and Scotty says that they must do something. Kirk however says that it's not yet time and they are not prepared.

Act Three
Back in the bar, McCoy and Spock work on the gas grenade. McCoy and Scotty give Spock a hard time for not showing any feelings over Chekov's death, as Scotty points out, he and Chekov worked closely together on the Enterprise. Kirk asks the two of them to stop but Spock notes that they forget he is half-Human. Spock observes that Chekov as Billy Claiborne died, but in the actual gunfight at the OK Corral, Billy survived. Kirk takes it to mean that the outcome of the conflict does not necessarily correspond with the historical outcome. 

Kirk finds the sheriff and asks him to stop the fight, but Behan says that no one wants to stop the fight, and that it is a little late for Kirk to decide he "does not have the belly" for it. The sheriff tells Kirk that the people in the town are counting on Kirk to get rid of the Earps for them, and that no one would deny them their revenge for killing Billy. Kirk angrily says they just can't just kill them, but the sheriff says that there will be no questions asked as Kirk puts his hands around his neck. Upon seeing he will get no help from the sheriff, Kirk walks away.

With time running out, Scotty volunteers to test McCoy and Spock's gas grenade. Despite McCoy and Spock's careful preparation, it does not work, even when Scotty deeply inhales it. Spock finally realizes that nothing around them is real and that the entire scenario has been taking place in their minds. 

Kirk vows not to leave the bar until "well after 5 o'clock", but suddenly finds himself and the others teleported to the O.K. Corral where they cannot leave either, as it is surrounded by force fields.

Act Four
The corral is encircled by a force field so that escape is impossible. Spock, realizing this situation is only as real as their minds accept it to be, tries to convince the others that if they recognize that the situation is not real, they will not die and Kirk observes that the "smallest doubt" would be enough to kill them, just as it had killed Chekov. McCoy argues that they don't have that "clockwork ticker" in their heads like Spock, that they can't just turn it off and on at will. Kirk says that they must. Using a mind meld, Spock is able to convince everyone else that the bullets are not real, they are merely "shadows" and "illusions," "spectres without body… to be ignored." 

The Earps arrive and demand that the ersatz Clantons draw, but the landing party refuses. The Earps begin shooting when Kirk reaches for his gun, but the bullets harmlessly pass right through the landing party, hitting the fence behind them. When the Earps deplete their ammunition, Kirk attacks Wyatt Earp and knocks him to the ground. Kirk draws his gun, and is about to shoot him, but upon seeing the abject terror in Wyatt's eyes, he releases him.

Suddenly, the landing party finds themselves back on the bridge of the Enterprise. Chekov is alive and well, sitting at his station, and wonders "where have I been?" Kirk suggests they have been on the bridge the whole time, and that Chekov survived because the only thing that was real to him was the girl. The Melkotian buoy, once again directly in front of them, begins to emit M-rays beyond measurable levels, and then explodes. A Melkotian appears on the main viewer screen, noting that Kirk did not kill. Kirk explains that they fight only when there is no choice, and prefer peaceful contact. The Melkotians extend an invitation to establish relations with the Federation, and asks Kirk to send a delegation to the planet.

Spock then asks Kirk a "personal" question: did he actually want to kill the Earps? Kirk agrees that is exactly how it was that afternoon, and how it was in 1881. Spock wonders how Humanity managed to survive. Kirk says that Humans overcame their instinct for violence, receiving a doubting look from Spock as he moves back to his console. The Enterprise then begins its orbit of Melkot.

Log entries
 Captain's log, USS Enterprise (NCC-1701), 2268

Memorable quotes
"History cannot be changed."
 - Spock to Kirk, on the OK Corral 

"Is this a dead man, doctor?"
"Very dead, Mr. Spock."
 - Spock and McCoy after checking on a man Morgan Earp kills outside of the saloon

"I always said you was yellow, Clanton."
"I'll make one more attempt to get through to you, Mr. Earp. My name is not Clanton; it's Kirk."
"Oh, yeah. We heard the talk about your jokes."
"I'm not joking."
"Sure. Well, I'm glad to meet you, Mr. Kirk!"
 - Virgil Earp and James T. Kirk

"We don't want any trouble. We'll be glad to co-operate."
"Five o'clock, Clanton. Is that clear? If you're in town at 5:01, we'll kill every one of you whether you draw or not. Is that clear?"
 - Kirk and Wyatt Earp

"The emergency is real. I need these things."
"Your emergency sure is real. Go on, take the stuff. Have some more fun. Take my bag. Only best you be finished before five o'clock."
"That is my intention, Doctor."
"Because at one minute past five, you'll find a hole in your head. Right from this gun."
 - McCoy and Doc Holliday

"Captain, it's quite all right. They forget I am half Human."
 - Spock, after McCoy and Scott criticize his lack of grief over Chekov's shooting 

"It's to kill the pain."
"But this is painless."
"Well, you should've warned me sooner, Mister Spock. Fire away."
 - Scott and Spock, as Scott gulps down some bourbon before testing the tranquilizer 

"Physical reality is consistent with universal laws. Where the laws do not operate, there is no reality."
 - Spock to McCoy, at the OK Corral

"Ten minutes, and it's all going to end at the OK Corral. Well, we're going to wait right here until well after five o'clock. We're not going to move from this spot!"
 - Kirk

"We don't have that clockwork ticker in our head like you do. We can't turn it on and off."
 - McCoy, to Spock 

"Draw!"
 - Wyatt Earp, before the fight

"I wonder how Humanity managed to survive."
"We overcame our instinct for violence."
 - Spock and Kirk, on killing

Background information

Story and script
 The story outline titled "The Last Gunfight" was dated  and submitted . The outline was retyped and dated to  and submitted to NBC for approval on  by Fred Freiberger. The revised final draft was dated , and filmed in late May. 
 James Blish's adaptation in Star Trek 3 has the title as "The Last Gunfight". Among the differences in the adaptation, the tranquilizer is delivered via darts; in the episode, it is in the form of a nerve gas.
 The writing of this episode was influenced by a series of memos which were sent between Gene Roddenberry and the executives at NBC, by the end of the second season, and which proposed that Chekov be featured in the third season more than he had been, up to that point. (Cinefantastique, Vol. 22, No. 5, p. 40)
 The episode originally aired only one day before the 87th anniversary of the original gunfight at the O.K. Corral.

Production
 Clocking in at approximately five minutes and 25 seconds, this episode's teaser is the second longest in the original series, lasting 10 seconds shorter than the teaser for .
 This was the first episode produced for season three. As such, it was the first episode produced to feature blue text (rather than the yellow of the first two seasons) in the opening credits sequence.
 A very subtle change in the third season was the use of new sound effects for the pushing of buttons on the bridge.
 Another difference this episode brings is the "singing plant" background noise from , used for nearly every planet in seasons one and two, is replaced here by a warbly sound used before on the planet Triskelion. This will again be used intermittently throughout season three –for example, in  and .
 Jerry Fielding's unique score adds atmosphere to this episode. When the villains are first seen in the saloon, Fielding has the piano play stereotypical "menace" notes and a bizarre rendition of "Buffalo Gals". Fielding's other Star Trek contribution was his score for .
 A short clip in the third season blooper reel shows the Melkotian head wearing a fake mustache and horn-rimmed glasses. (Star Trek: Lost Scenes) Writing in an issue of the fan magazine Enterprise Incidents, James Van Hise said that the glasses belonged to co-producer Robert H. Justman.

Sets and props
 The original script specified filming the episode on location in an outdoor Western town. However, due to budget restrictions, filming was confined to the regular studio stages. To avoid having to build a complete Western town set, the concept of an incomplete town, put together from "bits and pieces" out of Kirk's mind, was developed, thus allowing the episode to be filmed within budget. (The Star Trek Compendium; Inside Star Trek: The Real Story, p. 403)
 This is TOS' only foray into surrealism, with unique set designs by Matt Jefferies.
 The sign that says "sheriff" has an identical font to the main titles of the show. 
 Mike Minor was the designer of the Melkotian's mask.

Cast and characters
 George Takei (Sulu) does not appear in this episode. 
 According to an interview in The World of Star Trek, James Doohan intensely disliked the back combed hairstyle he debuted in this episode, which was not his own choice. By the filming of , this hair-do is gone for good, though viewers would see it again in  and , which weren't aired until December of that year.
 Several of the actors in this episode, including DeForest Kelley and Charles Seel, acted extensively in Westerns throughout their careers. Kelley previously played Ike Clanton in a 1955 episode of  and Morgan Earp in the 1957 film .
 Rex Holman (Morgan) later played the settler J'onn in .

Continuity 
 This is one of three episodes that confirm Uhura's native language of Swahili (the other two being  and ). 
 This is the second time that McCoy believes he cannot be harmed by a weapon (this time due to Spock's convincing in a meld); the first time, when he stands his ground as the Black Knight charges him in , this strategy was unsuccessful, as the weapon (a lance) was physically real, not merely an illusion.
 This is the only episode to end with the Enterprise heading toward a planet.
 Star Trek characters revisited the Old West in .  That episode used outdoor sets, something the Original Series episode was unable to achieve due to budget constraints.
Prior to the release of the new Star Trek movie franchise by J.J. Abrams, this episode was the only time in any Star Trek series or film in which James T. Kirk is referred to as "Mister Kirk" rather than his usual title of Captain (and later Admiral) Kirk.

Production timeline
 Story pitch by Lee Cronin, titled "Execution, 1872", 
 Story outline by Cronin, titled "The Last Gunfight", 
 Story outline re-dated to 
 Submitted to NBC for approval on  by Fred Freiberger
 First draft teleplay, 
 Second draft teleplay, 
 Revised first draft teleplay, 
 Final draft teleplay by Arthur Singer, 
 Additional page revisions by Fred Freiberger, , , , , , , ,
 Filmed:  – 
 Score recording, 
 Original airdate,  
 Rerun airdate, 
 First UK airdate

Video and DVD releases
Original US Betamax release: 
 UK VHS release (two-episode tapes, CIC Video): Volume 29, catalog number VHR 2381, 
 US VHS release: 
 UK re-release (three-episode tapes, CIC Video): Volume 3.1, 
 Original US DVD release (single-disc): Volume 28, 
 As part of the TOS Season 3 DVD collection
 As part of the TOS-R Season 3 DVD collection

Links and references

Starring
 William Shatner as Kirk/Ike Clanton

Also starring
 Leonard Nimoy as Mr. Spock/Frank McLowery
 DeForest Kelley as Dr. McCoy/Tom McLowery
 James Doohan as Scott/Billy Clanton
 Walter Koenig as Chekov/William Claiborne
 Nichelle Nichols as Uhura
 Bonnie Beecher as 
 Ron Soble as Wyatt Earp
 Charles Maxwell as Virgil Earp
 Rex Holman as Morgan Earp

With
 Sam Gilman as Doc Holliday
 Charles Seel as Ed
 Bill Zuckert as Johnny Behan
 Ed McCready as Barber
 Abraham Sofaer as Melkotian (voice)

Uncredited co-stars
 William Blackburn as Hadley
 Charles Cirillo as illusory bar patron
 James Doohan as Melkotian buoy (voice)
 Roger Holloway as Roger Lemli 
 Jeannie Malone as yeoman
 Bob Orrison as Cowboy
 Eddie Paskey as Leslie
 Unknown actors as
 Two bar patrons
 Morgan Earp's victim

Deleted scenes 
The following actors were cast but their scenes were cut from the finished episode.

 Richard Anthony as Rider
 Gregg Palmer as Rancher

References
19th century; 1880; 1881; afternoon; alien; alliance; alloy; American frontier; American West; amount (aka quantity); analysis; annals; answer; apothecary; area; Arizona; baking soda; "barrel of laughs"; bartender; "bits and pieces"; body; "Bones"; bourbon; bullet; Buntline Special; bushwhack; cactus; cattle rustler; chance; choice; circa; ; Clanton gang; ; ; clock; clockwork; close range; clothing (aka clothes); Colt; communicator; concept; contact; contradiction; corn whiskey; Cossack; cotton wadding; creature; damage report; dance; ; deflector; deflector shield; dentist; device; discussion; disease; disobedience; dizziness; double-barreled shotgun; doubt; dream; drug; Earp gang; Earth; Earth history; emergency; energy output; English; era; evaluation; event; execution; existence; expert; face; fact; falsehood; fast draw; feeling; fire; "fire away"; first contact; fog; force field; fun; gallon; gas; gas grenade; ghost; gown; grief; guest; gun; hailing frequency; handgun; head; health; Hell; "hell for leather"; hello; here and now; hole; holster; horse; hour; Human (aka Humanity); humanoid; illusion; individual; ingenuity; ingredient; instinct; intention; intercept; joke; justice; kilometer; Kirk's ancestors; knowledge; label; Latin language; law; lead; leather; lie; lifeform; M-ray; marriage; material; Mazeppa; ; ; medical bag; medicine; Melkotian; Melkotian buoy; Melkotian planet; memorial; metal; mile; mind; mind meld; minute; mission; mistake; morning; mortar and pestle; murder; muscle; name; negotiation; October; OK Corral; ; opinion; opportunity; order; pain; palpitation; peace; phaser crew; phaser gun (aka phaser); physical examination; physical law; physician; pioneer; place; plant; plea; poison; power source; problem; punishment; question; ; rancher; range; reality; red alert; reflex; revenge; revolver; right; risk; room; ; rule; Russian; science officer; scotch; scum; scurvy; second; sector; senses; sense of humor; sensor; sentence; shadow; shave; Sheriff; shirt; shopping; shopping bag; "shoot off their mouth"; snake; solution; space; specimen; speed; standard orbit; stealing; stomach; subject; Swahili; sweating; Taos lightning; telepath; telepathy; thief; thing; thought; thought pattern; time; Tombstone; Tombstone Epitaph; town; town marshal; tranquilizer; tranquilizer grenade; transporter mechanism; transporter room; tricorder; United Federation of Planets; United States of America; universal laws; ; venom; violence; volunteer; Vulcan language; warning buoy; weapon; wedding; wedding ball; wedding gown; week; word; yard; yellow; xenophobia

Tombstone Epitaph references 
1930s; bicycle; chief counsel; Commerce Department; depression; dollar; economy; election; Europe; furnishing; gent; gold; month; quarter; Skipworth and Co; year

External links 
 
 
 
 

de:Wild West im Weltraum
es:Spectre of the Gun
fr:Spectre of the Gun (épisode)
ja:危機一髪！OK牧場の決闘（エピソード）
nl:Spectre of the Gun
pl:Spectre of the Gun
TOS episodes