The Starship Enterprise has gone back in time to study the 1960s on Earth, in particular to figure out how the planet survived said decade. Whilst there, they meet Gary Seven, who claims to be a human trained by aliens to interfere in human affairs in the interests of good - he certainly has access to transporter technology far in advance of that of the United Federation of Planets.
He, along with his colleague, Roberta Lincoln, make an attempted launch of an orbital nuclear weapons platform fail, thus preventing future attempts. James T. Kirk and Mr. Spock try to stop this, but fail. Following this, the Enterprise heads back home to the future.