A court martial referred to a judicial proceeding within a military or quasi-military organization, or the officer(s) who sat as a court to conduct the proceeding.
Offenses tried before a court martial ranged from insubordination to culpable negligence to violations of Starfleet General Orders. A member of the service who stood accused was presumed innocent until proven guilty, and the service member was entitled to counsel at the preliminary hearing as well as the general court martial. That right could be waived, or the accused could elect to retain counsel. If this initial inquiry determined that a general court martial should be convened, the prosecution was conducted by a Starfleet Judge Advocate General officer.
No fewer than three officers of command or flag rank comprised the court. The senior officer of the court martial acted as the president. This officer controlled the mode and order of presentation of evidence, as well as making evidentiary rulings. Proof was presented through oral testimony and exhibits, including record tapes. The accused had the right to face his accusers, cross-examine witnesses, as well as to testify.
After finding of guilt was entered, or if the accused had pleaded guilty, the defendant was allowed to introduce evidence that either mitigated or explained guilt. (TOS: "Court Martial", "The Menagerie, Part I", "The Menagerie, Part II")
Alternatively, Starfleet could convene a board of inquiry to engage in factfinding.
In the 23rd century, some Starfleet ships carried a court reporter for the purpose of recording statements, presumably for later use at an official inquiry or court martial. (Star Trek VI: The Undiscovered Country)
James T. Kirk and Spock
In 2267, Commodore Stone served as President of the Court in the court martial of Captain James T. Kirk, on Starbase 11, over the alleged death of his records officer, Lieutenant Commander Benjamin Finney. This marked the first time a Starfleet starship captain stood trial in a court martial. Kirk was cleared of all charges when it was revealed that Finney had actually faked his own death. (TOS: "Court Martial")
Also in 2267, Lieutenant Commander Spock requested and received an on-board court martial for his actions related to hijacking the USS Enterprise and violating General Order 7. The court consisted of an illusion of Commodore Jose Mendez, Fleet Captain Christopher Pike, and Spock's commanding officer, Captain Kirk. Although Mendez was never actually present, he did receive the images transmitted by the Talosians, and he ordered that General Order 7 was suspended on that occasion. (TOS: "The Menagerie, Part I", "The Menagerie, Part II")
In 2269, Janice Lester, while inhabiting the body of Captain Kirk, charged Commander Spock and "Janice Lester" (who was actually Kirk), with mutiny and convened a summary court martial. The proceedings were bizarre and none of the usual procedures intended to protect the accused's rights to due process were in evidence. In fact, the other members of the trial board – Lieutenant Commander Montgomery Scott and Doctor Leonard McCoy – were similarly charged during the court martial and found guilty of mutiny along with Spock and Kirk. Lester then ordered their immediate execution. Ultimately, it was revealed that Lester had transposed her consciousness with Kirk and the orders of the sham court martial were never enforced. (TOS: "Turnabout Intruder")
In 2286, then-Admiral James T. Kirk and his subordinates expected to face a court martial after stealing the starship Enterprise in order to "rescue" Captain Spock. However, after the officers engaged in a successful effort to save Earth from an alien probe, the Federation Council instead tried the accused. The Council summarily dismissed all charges but one; Kirk alone stood accused of disobeying a direct order of a superior officer. His guilty plea was accepted and for this, and Kirk was reduced in rank to captain and "sentenced" to the duties appropriate for someone that rank – command of a starship. (Star Trek IV: The Voyage Home)
In many cases, the loss of a starship automatically triggered a court martial of the ship's commanding officer. In 2355, the USS Stargazer was lost in the Maxia Zeta star system. During his court martial, Captain Jean-Luc Picard was prosecuted by Phillipa Louvois. Picard was cleared of all charges. (TNG: "The Measure Of A Man")
Twenty years later, having been captured by the Son'a while helping the Ba'ku prevent a forced relocation so the Son'a could harvest the metaphasic radiation in their planet's rings, Picard was told by Admiral Dougherty that, should he order the Ba'ku to surrender, the admiral would make sure he wouldn't be court-martialed – to which the captain responded that, if it took a court martial to expose the injustice occurring on Ba'ku to the people of the Federation, he looked forward to such a hearing. Seconds later, however, a furious Ru'afo stormed in, thundering that the USS Enterprise had destroyed one Son'a warship and severely damaged another – actions Picard knew Commander Riker would only have taken if the Son'a had attacked first. Since Picard knew that Ru'afo never would've ordered such an attack without a green light from Dougherty, he asked the admiral who would be facing a court martial now – though Dougherty was murdered by Ru'afo before any action could take place. (Star Trek: Insurrection)
Sometime in the mid-2360s, Ensign Ro Laren of the USS Wellington was court-martialed after disobeying direct orders on an away mission to Garon II. Her disobedience was alleged to have led to the deaths of eight of her crewmates. Ro refused to speak in her defense, and the court found her guilty. She was imprisoned in the stockade on Jaros II until her release in 2368. (TNG: "Ensign Ro").
In 2370, Picard threatened Ro with a court martial if she failed to follow her orders to lure Maquis members into a trap, but was ultimately unable to take any action following her defection to the Maquis. (TNG: "Preemptive Strike").
When the Maquis leader Michael Eddington defected to the Maquis in 2372, Captain Benjamin Sisko vowed to track him down and see him court-martialed. After his capture by Sisko and the crew of the USS Defiant the following year, Eddington was indeed court-martialed, convicted, and later imprisoned for treason against the Federation. (DS9: "For the Cause", "For the Uniform", "Blaze of Glory")
In 2367, Picard threatened Data with a court martial, and probable dismantlement, in order to find out what had happened to the crew of the USS Enterprise during a missing day they'd experienced. (TNG: "Clues").
In an alternate timeline, Captain Janeway's refusal to obey The Doctor's order for her to be relieved of command would have been met with a court martial. However, Janeway pointed out that compared to the damage and hardship that Voyager had endured over the course of the year, "a court martial would be a small price to pay" and claimed she'd be "happy to face to the music" if they ever made it back to Federation space. (VOY: "Year of Hell, Part II")
- In 2154 Commander Charles Tucker III joked that he would save Lieutenant Reed a seat at his court martial after Reed expressed his doubts about Tucker's orders to inform the Andorians about the plans of the Vulcan High Command invasion of Andoria. (ENT: "Kir'Shara")
- In 2369 Major Kira Nerys refused the order of Commander Benjamin Sisko to leave him and Jadzia Dax in the cavern and take the way home. After Sisko repeated that this was an order, Kira just answered, "Court martial me.". (DS9: "Move Along Home")
- In 2371, Benjamin Sisko told Miles O'Brien that it seemed like Jake was worried that he was going to court martial Mardah. (DS9: "The Abandoned")
- After Benjamin Sisko returned from rescuing Odo and Elim Garak from the Gamma Quadrant, Admiral Toddman sternly told him that "if you pull a stunt like that again, I'll court martial you... or promote you. Either way, you'll be in a lot of trouble". (DS9: "The Die is Cast")
- In 2375, Janeway commented that there were grounds to court martial Chakotay after he deliberately left his colleagues in the holodeck, watching an uninteresting presentation by The Doctor, when he'd been given orders to interrupt by initiating yellow alert at 2100 hours. (VOY: "Nothing Human")
- In 2375, after Worf, undergoing jak'tahla due the the metaphasic radiation from the Ba'ku planet below (which the Enterprise crew was not yet aware of), overslept into his duty shift at tactical, Picard paged Worf to wake him up:
- Picard: "I don't know how they do it on Deep Space 9, but on the Enterprise we still report for duty on time."
- Worf: (bangs head on ceiling) "Sorry sir, I'm on my way."
- Picard: "We'll skip the court martial this time. Picard out." (Star Trek: Insurrection)