A bodiless entity that fed on hostility trapped the Enterprise crew and Kang's Klingons aboard the ship and kept them fighting until they joined together to drive it off.
In 2268 the Enterprise answered a distress call at Beta XII-A and found a disabled Klingon ship. Its commander, Kang, accused Kirk of attacking it, and his crew, including his wife and science officer Mara, were taken aboard. An entity made of energy had arranged the meeting. It turned phasers into swords, made the crew believe false memories of atrocities and healed the wounded so the fighting could continue forever, while keeping the ship out of control.
Spock found the being in the ship, and Kirk persuaded Kang that they were being manipulated. The two sides stopped fighting and drove the entity from the ship with laughter.