On stardate 4202.1, while on routine deep space exploration, the Constellation encountered several destroyed solar systems, including systems L-370 through L-374. Although exceptionally heavy subspace interference prevented contact with Starfleet, the ship began to investigate.
Upon entering the L-374 system, the ship's science officer, Masada, discovered that L-374 IV was breaking up. Upon closer inspection, an enormous robot was found hovering over it, slicing out chunks of the planet with an antiproton beam.
While attempting to intervene, the Constellation was attacked by the planet killer. The ship's deflectors were easily pierced and the resulting damage crippled the ship, forcing it to hide in the inner system. Nearly without power, all but defenseless, and with the life support system failing, Decker ordered his crew to abandon ship and beam down to L-374 III where they could take refuge. The commodore would remain behind to operate the transporters. Attempts to contact Starfleet failed and a distress call was sent out.
The robot attacked the Constellation once more, knocking out the transporters and stranding Decker on the ship alone. The robot then proceeded to devour L-374 III, killing the remainder of the ship's crew. The deaths of 430 of his crew would have a severe psychological impact on the commodore.
A short time later, on stardate 4202.9, the USS Enterprise picked up Constellation's distress call while passing through that sector. The signal extremely weak and only the word "Constellation" could be made out.
The Enterprise soon located the Constellation, adrift, and determined it to be wrecked by the same disaster that destroyed the systems within the sector. The damage analysis on the Constellation found a display of abnormal energy output: all power plants were dead, reserve energy banks were at a very low power level, and the life support systems were barely operative.
The entire bridge was damaged and uninhabitable; however, the rest of the ship was able to sustain life. Radiation levels were normal; atmospheric pressure was at eleven pounds per square inch. The ship's computer system was still intact, but its filtration systems were out, and the Constellation's communication systems were shorted out as well.
The warp drive was deemed "a hopeless pile of junk", and the impulse engines were not "too badly off" despite having their control circuits fused solid. The ship's phaser banks were nominally operational, but required recharging.
Once the Enterprise's landing party beamed aboard the Constellation, they found the entire ship a mess. The landing party split up: Scotty's team went to the engineering section, while Kirk and McCoy tried to find Decker or his crew.
However, there were no bodies or survivors present. It was assumed that the crew wasn't abducted, but had simply left. Kirk called Spock on the Enterprise and asked if the crew may have beamed to one of the two planets they found intact when they entered L-374.
Spock commented that the two planets were uninhabitable to Human life; one had a surface the temperature of molten lead, and the other had a poisonous atmosphere. From this, they concluded that the entire crew was on one of the now destroyed Class M planets.
Eventually, the landing party found Decker in auxiliary control, passed out. Kirk tried to get everything possible from Decker, but the man needed treatment on board the Enterprise.
The landing party finally acquired the captain's log and played the recording, discovering the true fate of the destroyed solar systems. The Enterprise was prepared to take the Constellation in tow, so Decker and McCoy beamed aboard the Enterprise while Kirk and his party remained.
The robot once again returned to L-374 and attacked the Enterprise. After some hasty repairs, the Constellation was operable enough to have a single phaser bank recharged, shield power was temporarily restored, and ½ impulse power was available.
However, nothing could be done after the machine had attacked. After the Enterprise had made a number of unsuccessful attempts to stop the robot, it was determined that the only way to destroy it was by exploding the Constellation inside the robot since now the Constellation had little else to offer with its commanding officer and entire crew dead.
At first, Kirk thought of activating the ship's destruct system, but, there was not enough power for the destruct system to be put into action. Kirk ordered Scotty to overload the Constellation's impulse engines from auxiliary control.
While Scott beamed back aboard the Enterprise and no one was left aboard the Constellation, Kirk activated the machine. After further rigging the hulk, the impulse engines were overloaded in the maw of the robot creating a 97.835 megaton fusion explosion that destroyed the Constellation and rendered the planet killer inert. (TOS: "The Doomsday Machine")