Arriving at the planet Deneva, home of Kirk's only brother Sam and his family, the U.S.S. Enterprise picks up a transmission from a Denevan pilot who has steered his craft into the sun to destroy some unknown menace.
Beaming down to the planet, Kirk finds his brother dead and Sam's wife in a fatal condition. Their only son, Peter, survives informing the landing party of what has occurred. It seems that Deneva has been infested with large, amoeba-like aliens that attack humans and intertwine their tentacles with the body's nervous system. They can move short distances through the air and use excruciating pain as a means of controlling their victims.
When Spock is attacked by one of the creatures, he uses his Vulcan mind control to overcome the pain and return to duty. However, a cure must be found; they must find a way to kill the parasite without harming its host.
Kirk remembers the pilot that flew into the sun and suggests that they may be sensitive to intense light. Spock volunteers to be McCoy's test patient and the doctor bombards him with light beams so strong that the Vulcan is blinded. Too late, the doctor realizes that only ultraviolet light is needed to kill the creatures.
Kirk sets off ultraviolet satellite flares over the planet Deneva, freeing its people from the parasites. Fortunately, Spock's blindness is temporary, due to a second eyelid developed by Vulcans to protect their eyes from the harsh sun on planet Vulcan.