The Mirror, Mirror Incident (Star Trek)

After failing to persuade the Halkan Council to allow the Federation to mine dilithium crystals on their planet, Captain James T. Kirk, along with Chief Medical Officer Dr. McCoy, Chief Engineer Scott, and Communications Officer Uhura, begin to be transported back to the Enterprise, when an ongoing ion storm causes a transporter malfunction, and the landing team instead materialize aboard an unfamiliar Enterprise. Their parallels simultaneously materialise on the Enterprise in this universe, and are thrown in the brig by Mr Spock who immediately recognizes the changed personalities of the barbarian landing party.
The group realizes something is amiss as they walk off the transporter pad. First Officer Spock, who now has a Van Dyke beard, orders the bridge crew to prepare a phaser barrage on the Halkans in retaliation for their refusal to cooperate, then uses an "agonizer" device to punish the transporter operator for a malfunction. In this alternate universe, the USS Enterprise is called an "Imperial Starship" or ISS Enterprise, and a brutal empire has replaced the Federation. Officers ascend in rank by assassinating their superiors, uniforms are more revealing, sidearms are standard issue (as well as daggers for officers), and torture substitutes for discipline.
Kirk orders the landing party to Sickbay on a pretense, so they can assess their predicament in private. He deduces that the ion storm must have opened a barrier between parallel universes, and the two landing parties have switched places. They decide to impersonate their counterparts until they can find a way home, while Scotty sabotages the ship's phasers to buy time for the Halkans. Uhura ascertains that Star Fleet has ordered the Halkans' destruction if they refuse, and Kirk can only order a delay, so Spock reports Kirk's hesitation to Star Fleet. Kirk heads for his quarters and is nearly assassinated by Chekov and his henchmen, one of whom betrays Chekov and saves Kirk's life.
Kirk's bodyguards arrive and take Chekov to "the Booth". When Scotty and McCoy join him the computer confirms Kirk's hypothesis and devises a procedure they can use to return to their home universe. Kirk also learns that in this universe, his counterpart took command of the ISS Enterprise by assassinating Captain Christopher Pike and has since committed numerous atrocities. Aboard the USS Enterprise, Spock has concluded that the transporter switched the landing party with their mirror-universe counterparts in the ion storm, but has no way to return them as yet.
On the ISS Enterprise, Scotty and McCoy secretly work to rig the warp engines and transporter to get the landing party home. Kirk receives a warning from Spock regarding his perceived weakness, and disobedience of Star Fleet. Kirk counters the warning, releases Chekov from the Agony Booth and returns to his quarters. There he finds the beautiful Lieutenant Marlena Moreau, who refers to herself as the "Captain's Woman", stretched out on his bed. He hesitates to embrace her, and she is put off but assumes he is scheming as usual, aware of the controversy on the bridge. Then Spock interrupts to inform Kirk that Star Fleet Command has ordered him to kill Kirk and take command unless Kirk annihilates the Halkans within four hours. Marlena reminds Kirk of her loyalty by activating the Tantalus Field, a weapon concealed in Kirk's quarters. She focuses the device on Mr. Spock, lamenting his imminent demise, but as she reaches to silently "eliminate" him, Kirk pulls her hand back, to her surprise. He reassures her that she is still the Captain's woman before he leaves.
In his own quarters, Spock, already suspicious of the landing party, queries the computer about the "classified research" being conducted in Engineering, and decides to confront Kirk again. On the bridge, Uhura distracts Sulu, the security chief, from his security board when it signals Scott's final connection. Spock intercepts Kirk in the transporter room and leads him at phaser-point to Sickbay, where Scott, McCoy, and Uhura had been waiting to rendezvous with Kirk. A fight ensues, until Spock is knocked out by Kirk. McCoy insists Spock could die if untreated, and before they can leave, Sulu arrives with three security guards. Sulu tells them he intends to assassinate Kirk and make it look like Kirk and Spock killed each other, but Marlena intervenes from Kirk's quarters, using the Tantalus Field to vaporize Sulu's henchmen. Kirk renders Sulu unconscious, and Uhura, Kirk, and Scotty head for the transporter room. They leave McCoy to follow after tending to Spock, but Spock suddenly awakens and forces McCoy into a Vulcan mind meld to find out why the captain spared his life. When he learns of the switch, he decides to help them return and disables the transporter until he can reach them.
Kirk, Scotty, and Uhura reach the transporter room to find Moreau waiting. She asks Kirk to take her with them, but Kirk explains the transporter is set for four people. Moreau points a phaser at Kirk, but Uhura disarms her. They discover power to the transporter is cut, and Scott can only reset the controls to allow manual operation - requiring one of them to stay behind. Spock arrives and announces he will operate the controls. Kirk takes a moment to tell Spock that his Empire is illogical and doomed to self-destruct, to which Spock agrees. He urges Spock to take command, spare the Halkans, and find a way to make peace. When Spock reminds him of the necessity of power, Kirk reveals the existence of the Tantalus Field. Kirk also reassures Marlena that she is still a Captain's woman, suggesting that she ally herself with Spock.
Kirk, McCoy, Scotty, and Uhura beam out, and the switch with their counterparts is successful. At home in the Federation universe, Spock reports he found the ruthless attitude of the Mirror landing party refreshing, calling their evil counterparts "the very flower of humanity". Kirk is approached by his own universe's Lieutenant Marlena Moreau, a recent transfer to the Enterprise, with a report for his signature. She appears not so different from her parallel counterpart, and Kirk tells Spock that Moreau "seems like a nice, likable girl" and that he thinks they "could become friends".