A court martial (plural courts martial) is a military trial chaired by a panel of officers, usually to determine the innocence or guilt of the officer facing charges. The term can also refer to the panel of officers reviewing evidence.
Like in any court, the accused is innocent until proven guilty and also has the right to counsel.
A preliminary hearing is held first to determine whether a court martial must be faced. If found true, the prosecution is usually conducted by a Starfleet Judge Advocate General.
The court martial panel is comprised of three command or flag rank officers, with the most senior officer taking charge of the panel. Evidence allowed in the trial includes oral and written testimonies, records, sensor readings and exhibits, amongst other things. The person being accused has the right to face his or her accusers, cross-examine witnesses and testify on his or her own behalf.
Captain John Sill faced court martial in 2371 after the loss of the USS Prospect during a Special Operations mission to the Gamma Quadrant to make first contact with the Dominion's Founders. (Star Trek: The Prospect Chronicles) This is assumed as Sill was given command of the Galaxy-class USS Prospect-A later in the same year.
In 2373, USS Cantabrian commanding officer Noel Turner and second officer Antonio Ramirez faced a court martial, mostly for their disobedience of orders not to interfere with the aftermath of Samantha Delaney's triggering of her folded space drive prototype, a remnant of which was severely affecting a pre-warp planet and its inhabitants. The court marital, comprised of Admiral Zahara Hogan, Captain Liam de Gaillimhe and another Starfleet captain, found both not guilty. (Star Trek: The Cantabrian Expeditions: "Salvation", "Repercussions", "The Betrayed")
In the Lyran Starfleet, courts martial were operated on several levels, depending on the gravity of charges faced by the accused, with each county operating an appellate court martial, as well as superior and summary courts martial. (Star Trek: The Stoneship Files: "Attack on the Laboratory")