The M-5 multitronic unit, or the M-5 computer, was an advanced multitronic computer system and prototype created by Doctor Richard Daystrom during the mid-23rd century. It utilized very sophisticated technology, probably similar to the Human neural network, and much more sophisticated than the duotronic computer commonly in use at the time. According to Dr. Daystrom, the computer could think and reason like a Human. He had used his own memory engrams as a model for the computer. Models M-1 through M-4 were not entirely successful.
M-5 was installed on board the USS Enterprise in 2268 as a test of its capabilities. The M-5 drills were designed to allow the unit to command and control the ship during several exploration simulations and war games problems, where up to four other starships would attack the Enterprise. Manned with only a skeleton crew of twenty, the ship was completely run by the computer.
The unit was located in main engineering, and tapped directly into the ship's main power grid. When requiring more power, it would shut down unnecessary systems, including life support on decks without crewmembers.
During battle drills, the computer's self-preservation instinct became dominant, resulting in the destruction of the robot ship Woden and the deaths of several hundred Starfleet officers when it severely damaged the USS Excalibur and USS Lexington.
The senior crew attempted to cut off the computer from the ship's controls, but M-5 rerouted command functions through new data lines, and kept sending false signals through the original ones. The computer could also generate a force field around itself, effectively preventing anyone from coming near it.
Captain James T. Kirk made the computer self-destruct by asking it if it was right to kill another being. M-5 said that it was a crime against the laws of Man and God, and, believing that such a crime was punishable by death, deactivated itself. (TOS: "The Ultimate Computer")
The voice for the M-5 was played by James Doohan.
In a draft of the script for "The Offspring", the failure of the M-5 was considered a catastrophe for Starfleet for years. A century later, Vice Admiral Haftel used this incident as a case in point for closely guiding Lal's development of her artificial intelligence, blaming the incident on Daystrom's near-isolation during his research. 
In the game Star Trek: Shattered Universe the player must defeat the M-5 which has taken control of the mirror universe counterparts of the USS Excalibur, USS Hood, USS Lexington, and USS Potemkin and their fighters by destroying all four starships which shuts down the smaller vessels.