The pre-spaceflight Ekosians, as a result of their wars, were in a condition of anarchy in the mid-23rd century. This drew the attention of their sister world, Zeon, which had managed to live in peace for many generations, and had developed the beginnings of interplanetary spaceflight. Many Zeons came to Ekos in an effort to help their neighbors learn peaceful ways.
The Federation also took note of the chaos of Ekos, and dispatched the historian John Gill as a cultural observer to the upheaval in the mid-2260s. Gill had developed an idealization of Utopian fascism and decided his theories were a chance to save Ekos. He abandoned the non-interference policy for cultural contamination, and created a Nazi-style world government where he was the Führer. Subverted by his Ekosian Deputy Führer Melakon, Gill's best intentions quickly fell apart.
Using the Nazi model, Melakon used the presence of Zeons on Ekos in much the same way as Hitler used the Jews of Germany and Europe: as scapegoats blamed for Ekos' problems and declaring them a threat to be eliminated. With the technology elicited from Gill, Melakon had rapidly upgraded Ekosian weapons. By 2268 the "Final Decision", a nuclear attack on the planet Zeon, was being prepared for deployment.
The USS Enterprise, assigned to discover what had happened to John Gill, arrived in the Ekos-Zeon star system just before the launch of the "Final Decision". The intervention of Kirk, Spock, and McCoy roused Gill in time to call-off the nuclear attack, and Gill recanted his beliefs to Kirk as he died, insisting the Prime Directive was "the only way".
The regime created by Gill and Melakon proved to be weaker than their German model, as the Nazi government and "Final Decision" was not embraced by all of Ekos. An underground alliance of Zeons and Ekosians had formed, including high-level Nazi party members who wanted no part in the genocide. Kirk's actions allowed the Zeon Isak to kill Deputy Führer Melakon. Afterward, there appeared to be no impediment to the worlds working together. Spock observed that the union of the two world cultures would make a fine addition to the Federation. (TOS: "Patterns of Force")