Day of the Dove
A U.S.S. Enterprise landing party beams to a human-colonized planet in answer to a distress call. A Klingon ship, apparently damaged, is detected and a group of Klingons accuse Kirk of having damaged their ship. Kang, their leader, claims the U.S.S. Enterprise as a prize and Kirk beams the Klingons on board, reluctantly. However, Spock is warned by Kirk and quickly takes the Klingons prisoner. Both ships seem to have received the same, false, distress call.
A malevolent entity has entered into the U.S.S. Enterprise computer and excites both sides to aggressive behavior. It forces the ship out of control, rushing toward the galactic rim, while isolating a number of Klingons and U.S.S. Enterprise crew, heightening their sense of paranoia and violence turning them against each other. Phasers become swords and the battle begins.
Spock finally realizes that the entity feeds off hatred and emotional excitation and has acted as a catalyst to provoke combat, keeping the numbers on both sides even. Kirk is able, in the end, to make a common-cause truce with the Klingons and they drive the creature out of the ship with their laughter.