The Enterprise arrives at Sigma Iotia II and they make contact with a "Boss" Bela Oxmyx. Another starship, the Horizon visited the planet 100 years ago before the Prime Directive and sent back a report to Starfleet via conventional radio. Oxmyx gives them coordinates and Kirk beams down with Spock and McCoy. According to the report, the Iotians are a pre-industrial society and highly imitative.
The landing party materializes on a 1930s street with people carrying submachine guns. Two of them hold the landing party at gunpoint and tell them to surrender. They take the group's equipment and start to take them to Oxmyx, but a car drives by and guns down one of the gangsters. The other man identifies the shooters as members of Krako's gang and gets them to Oxmyx. He identifies himself as having the biggest territory in the world and tries to befriend the landing party. Spock spots a book "Chicago Mobs of the Twenties," and they figure that's why the Iotian culture is now set up like a mob. Oxmyx wants Kirk to provide him with advanced weapons and the captain refuses, then he holds them hostage to force the Enterprise to deliver.
Oxmyx has the landing party locks up then uses a communication to get hold of a puzzled Scotty. Kirk, Spock, and McCoy discuss how to resolve the situation and need Spock to get to his computers. Kirk confuses the guards with an imaginary card game and they knock out the men, then he sends McCoy and Spock to find a radio station while he goes after Oxmyx. However, he is quickly captured by men working for Oxmyx's rival, Jojo Krako.
Spock and McCoy get hold of the Enterprise and are beamed up. Krako wants to get weapons and teachers from Kirk and offers him a share, and isn't interested in Kirk trying to get everyone to sit down and talk. Kirk gets locked up but starts working with an old radio.
Oxmyx contacts Spock and tells him that Kirk has been captured, and offers to help in return for a meeting. He asks for a meeting and promises them safe conduct, and Spock accepts. Kirk strings up a wire from the radio then lures in the guard where they trip and he knocks them out, then makes his escape.
McCoy and Spock beam into Oxmyx's office where he immediately takes them prisoner. They try to get through to him about cooperating with the other bosses without any luck, but Kirk arrives and takes Oxmyx and his men prisoner. He and Spock then put on gangster suits and take a car to go to Krako's office. A local boy offers to help them get by the guards in return for "a piece of the action." The boy then fakes an injury and Kirk comes over as his father to help him… then they knock out the guards. However, Krako is waiting for them with armed men and they're forced to surrender.
Krako wants the phasers but Kirk takes over and says he's working for the Federation and they're going to put one guy in charge, then use him to keep control. Krako agrees and Kirk calls Scotty, secretly giving him coordinates to beam the mobster up to the Enterprise. They knock out the guards and head for Oxmyx'soffice where McCoy is standing guard. Kirk quickly bulldozes Oxmyx into agreeing then has him call the other bosses while Scotty locks on and beams them to Oxmyx's office. As Krako's men prepare to hit Oxmyx's place, Kirk organizes the mob bosses in return for the Federation getting 40%., but they're reluctant to go along. Krako's men attack and Kirk has the Enterprise blanket the street with phasers on stun. The mobsters are duly impressed and want Kirk to take over, but Kirk puts Oxmyx in charge of the new syndicate with Krako as his lieutenant.
Later as the Enterprise leaves orbit, Spock expresses his concerns about leaving criminals in charge. Kirk plans to explain to Starfleet that they'll take their cut and put into the planetary budget to help out the Iotians gain some moral responsibility. McCoy admits he left a communicator in Oxmyx's office. Spock warns that if the Iotians can take it apart, they'll be able to duplicate it… and may come gunning for the Federation.