While the crew of the U.S.S. Enterprise is charting the space just beyond the edge of the galaxy, the starship becomes caught in the hypergravitational pull of the dead star known as Questar M-17. Narrowly avoiding a collision with the massive and deadly stellar object, Captain James T. Kirk's crew settles the Enterprise into orbit around Questar, whereupon they discover a highly advanced and awe-inspiringly beautiful alien ship that dwarfs even the Federation's mightiest starships.
The enormous alien vessel appears to be some three hundred million years old, and looks utterly dead. Protected by life-support belts, Kirk, First Officer Spock, Dr. McCoy, and Chief Engineer Scott beam over to the ancient ship, where the boarding party discovers that the vessel was built by insectoid people who had become locked in a struggle against an invasive, hostile, and noncorporeal life form — which the team inadvertently brings back with them to the Enterprise.
This life form, an organism composed of electromagnetic energy, orders Kirk to take it to the center of the galaxy. Where it plans to spread itself far and wide, taking over every ship it encounters. Playing a cosmic game of "chicken,? Kirk instead sends the Enterprise heading straight toward the heart of Questar M-17 on an apparent collision course, thus forcing the entity to flee his ship an instant before a gravitational "sling-shot effect? carries the starship to safety. The creature, however, remains gravitationally trapped in orbit about the dead star, pleading with Kirk not to leave, and filling the cosmos with its plaintive wails of loneliness.