(Everyone appears to be unconscious as Kirk runs in alone.)
KIRK: Nomad? Stop what you’re doing and effect repairs on the life-support systems.
NOMAD: Stop.
KIRK: You’re programmed to obey the orders of your creator.
NOMAD: I am programmed to destroy those life-forms which are imperfect. These alterations will do so without destroying the vessel which surrounds them. It, too, is imperfect, but can be adjusted.
KIRK: Nomad, I admit that biological units are imperfect, but a biological unit created you.
NOMAD: I am perfect. I am Nomad.
KIRK: No, you’re not Nomad. You’re an alien machine. Your programming tapes have been altered.
NOMAD: You are in error. You are a biological unit. You are imperfect.
KIRK: But I am your creator.
NOMAD: You are the Creator.
KIRK: I created you?
NOMAD: You are the Creator.
KIRK: But I admit I’m imperfect. How could I have created such a perfect thing as you?
NOMAD: Answer unknown. I shall analyse.
(Spock enters, with Scott, two engineers and the requested anti-grav units)
NOMAD: Analysis complete. Insufficient data to resolve problem, but my programming is whole. My purpose remains. I am Nomad. I am perfect. That which is imperfect must be sterilised.
(The engineers remove the unconscious men and take their places at the controls.)
KIRK: Then you will continue to destroy that which thinks and lives and is imperfect?
NOMAD: I shall continue. I shall return to launch point Earth. I shall sterilise.
KIRK: You must sterilise in case of error?
NOMAD: Error is inconsistent with my prime functions. Sterilisation is correction.
KIRK: Everything that is in error must be sterilised.
NOMAD: There are no exceptions.
KIRK: Nomad, I made an error in creating you.
NOMAD: The creation of perfection is no error.
KIRK: I did not create perfection. I created error.
NOMAD: Your data is faulty. I am Nomad. I am perfect.
KIRK: I am the Kirk, the creator?
NOMAD: You are the Creator.
KIRK: You are wrong! Jackson Roykirk, your creator, is dead. You have mistaken me for him. You are in error. You did not discover your mistake. You have made two errors. You are flawed and imperfect and you have not corrected by sterilisation. You have made three errors.
NOMAD: Error. Error. Error. Examine.
KIRK: You are flawed and imperfect! Execute your prime function!
NOMAD: I shall analyse error. Analyse error,
KIRK: Now. Get those antigravs on it.
NOMAD: Examine error. Error.
(The anti-gravs are not stopped by any forcefields.)
KIRK: We’ve got to get rid of it while it’s trying to think.
SPOCK: Your logic was impeccable, Captain. We are in grave danger.
KIRK: Scotty, the transporter room.
NOMAD: Analyse error.
(Kirk and Spock carry Nomad out, followed by Scott.)
[Transporter room]
NOMAD: Error.
KIRK: Scotty, set the controls for deep space. Two ten, mark one.
SCOTT: Aye, sir.
NOMAD: Faulty!
Ready, sir?
NOMAD: Faulty!
KIRK: Nomad, you are imperfect!
NOMAD: Error. Error.
KIRK: Exercise your prime function.
NOMAD: Faulty! Faulty! Must sterilise. Sterilise,
KIRK: Now!
SCOTT: Energising.
(They observe the satisfying explosion on a monitor.)
[Bridge]
SPOCK: My congratulations, Captain. A dazzling display of logic.
KIRK: You didn’t think I had it in me, did you Spock?
SPOCK: No, sir.
http://www.chakoteya.net/StarTrek/37.htm
That’s awesome. One of my favs. That whole exchange and Kirk’s logical judo to beget self-immolation has been deployed by me a few times since I saw that episode years ago.