That same year, Cogley defended Captain James T. Kirk in a court martial, at the recommendation of Lieutenant Areel Shaw, after fellow Starfleet officer Lieutenant Commander Finney was apparently murdered.
Cogley was strong-willed and old-fashioned, preferring paper books to computers. He had an extensive collection of books, ranging from the Hebrew Bible to the work of the Tribunal of Alpha III in its original language. He claimed never to use the computer in his office. After Lieutenant Shaw recommended him to Kirk, Cogley moved into Kirk's room at the starbase, bringing many volumes of law books with him.
Cogley's courtroom style was impassioned and dramatic. Shaw said Cogley was "well known for his theatrics."
Kirk was being tried for culpable negligence leading to the death of Ben Finney. The USS Enterprise had been caught in an ion storm, and during the storm, Kirk had ejected an ion pod, with Finney apparently inside it. In his sworn account of the event, Kirk stated that he had ejected the pod several seconds after going to red alert. The computer log indicated that he had ejected the pod before going to red alert, while the ship was still on yellow alert. After Shaw, prosecuting at the court martial, presented a visual record of the log confirming the computer's account, Cogley privately asked Kirk if he wished to change his plea, claiming he could get Kirk off. Kirk, however, was certain, and decided to go forward with his plea of not guilty.
Cogley's suspicions were aroused when he and Kirk received a visit from Finney's daughter, Jame. She had previously accused Kirk of murdering her father, but during this visit, she begged Cogley to help him, saying she did not blame Kirk for her father's death.
Just before the trial was due to conclude – and after Cogley had rested his case – First Officer Spock entered the courtroom and informed Cogley that the Enterprise computer had shown signs of tampering. (Specifically, Spock had been able to beat it in three-dimensional chess five times running, which should have been impossible, as Spock programmed it to the same level as his abilities, meaning that the best that could be hoped for was a stalemate.) Cogley gave an impassioned plea to the court about Human rights, invoking the Bible, the Code of Hammurabi and of Justinian, the Magna Carta, the United States Constitution, the Fundamental Declarations of the Martian colonies, and the Statutes of Alpha III. He held that the court had denied Kirk the right to face his accuser, the Enterprise computer, and in so doing had elevated the machine above the Human. The court concurred, and reconvened aboard the Enterprise.
While Doctor McCoy used a white-sound device to prove that Finney was still alive and aboard the Enterprise, Cogley returned to the surface and brought Jame Finney on board, believing that the presence of Finney's daughter might make Finney himself easier to handle. Kirk apprehended Finney, and the charges against Kirk were dismissed.
After Kirk was acquitted, Cogley sent him a book as a farewell present. He planned to defend Finney against the charges related to his plot against Kirk, and was confident of an acquittal. (TOS: "Court Martial")
Cogley was played by actor Elisha Cook
In the stage directions from the final draft and the revised final draft of the "Court Martial" script, Cogley was initially described as, "A complete eccentric [...] Very old, but very spry." Later in the stage directions from Cogley's first scene, he was referred to (in both drafts) as a "headstrong old man."
Director Marc Daniels disliked directing Elisha Cook's performance as Cogley. "[He] wasn't very good with his lines [...] He had a terrible time with that," Daniels critiqued. Despite regarding Cook as "a fine actor," Daniels also felt that his annoyance over Cook's delivery of Cogley's lines, which frequently required the actor to be filmed saying single lines of dialogue because he couldn't remember two, ruined the experience of directing the whole episode. (Captains' Logs: The Unauthorized Complete Trek Voyages, p. 37)
Cogley was the protagonist of the Pocket Books novel The Case of the Colonist's Corpse, where Section 31 believed that he had an agenda that ran counter to the security needs of the Federation, and Agent Peter Lawrence was assigned to discover this agenda. Lawrence actually discovered that Cogley had no agenda, simply a firm conviction that all beings were entitled to the best possible defense in a court of law. Believing Cogley to be the single most honorable man that he had ever met, Lawrence resigned from Starfleet to work for him, and left Section 31 behind. It also states that Cogley was born in Montana on Earth in the year 2202. He was also a major character in the novel Crisis on Centaurus.
His middle name was given as Thomas in "Who's Who in Star Trek 1".
The alternate reality version of Samuel T. Cogley appears in the comic series Star Trek: Khan. Set after the events of Star Trek Into Darkness, Cogley was the lead prosecutor in the Federation's trial of Khan Noonien Singh. Cogley also request that Captain James T. Kirk and his first officer, Commander Spock be appointed adjunct counsels due to the special circumstances that brought them to the trial. Despite his position, he deferred to Kirk to make the opening statement.