Late one evening, at the U.S. Naval Base in Guantanamo Bay, Cuba, two Marines, Private First Class Louden Downey (James Marshall) and Lance Corporal Harold Dawson (Wolfgang Bodison) are arrested for assaulting and killing a fellow Marine of their unit, PFC William Santiago (Michael DeLorenzo).
At first it is assumed that they attacked Santiago because he reported Dawson to the Naval Investigative Service (NIS) for illegally firing his gun at a guard on the Cuban side of the island. However, Naval investigator and lawyer Lieutenant Commander Joanne Galloway (Demi Moore) suspects that Dawson and Downey, who were otherwise exemplary marines, were carrying out a "Code Red", an unofficial act of discipline in which soldiers are submitted to methods akin to bullying in order to get them to improve their performance, toe the line or follow procedure. Santiago compared unfavorably to his fellow Marines, being clumsy and lagging behind on exercises and was socially ostracized. He denounced Dawson in an attempt to be transferred away from Guantanamo.
Dawson and Downey are taken to a military prison in Washington D.C. to await trial. Galloway requests to defend them but the case is given to Lieutenant Junior Grade Daniel Kaffee (Tom Cruise), an inexperienced U.S. Navy Judge Advocate General's Corps lawyer. Kaffee has a reputation for arranging plea bargains and has never even argued a case in a court room, which gives him time to devote himself to his passion for softball. It is indicated that he has a psychological fear about having to match up to his late father, Lionel Kaffee, a leading attorney, who is regarded as one of the great trial lawyers of recent times. Galloway manages to get herself appointed as Downey's lawyer, thus playing a part in the proceedings. The third member of the defense team is Kaffee's friend Lt. Sam Weinberg (Kevin Pollak).
Kaffee meets with the defendants and finds that they are of the strictest type of Marines - those that serve in a "forward area" (on the line between their country and an enemy country) and are required to take their duties very seriously. Dawson is tough and authoritative and believes in honor and duty. Downey, a simple-minded young man and an archetypal village idiot, is guided solely by his devotion to being a Marine and his dedication to his superior, namely Dawson.
Kaffee, Weinberg and Galloway go to Guantanamo Bay to examine the crime scene. They also meet the base commander, Col. Nathan R. Jessup (Jack Nicholson), his executive officer, Lt. Col. Matthew Markinson (J.T. Walsh) and Santiago's commanding officer, Lt. Jonathan Kendrick (Kiefer Sutherland). Pressed by Galloway, Jessup denies that Code Reds, which are against military guidelines, are actually encouraged but makes little secret of the fact that he sees them as a good way of enforcing discipline, especially on the front line. Jessup also tells them that he arranged for Santiago to leave the base for his own safety once his denouncing of Dawson became known but that he died before he could leave.
When the defense team returns to Washington D.C., they learn that Markinson has gone AWOL and is unlikely to be found since he is a veteran intelligence operative who can cover his tracks.
Hours before Santiago's death, Kendrick assembled his men and told them that they were not to touch him. However Dawson and Downey now tell Kaffee and Galloway that Kendrick subsequently went to their room and ordered a Code Red on Santiago. They never intended to kill him, just to shave his head in order to teach him a lesson, but he died as a result of a rag being shoved into his mouth as a gag.
The prosecution is led by Marine Captain Jack Ross (Kevin Bacon) who is a friend of Kaffee's. Ross makes no secret of the fact that he has been given a lot of leeway by his superiors to close the case. Colonel Jessup is expected to take up an important post with the National Security Council (NSC) and this could be put in jeopardy due to the Santiago affair. In fact, Kaffee may have been appointed specifically because of his reputation for plea-bargains and the hope that the case would never make it to court. Ross offers a deal which will see Dawson and Downey serving just six months in prison. When Kaffee puts this to the defendants, however, Dawson regards such a move as cowardly and dishonorable and rejects it. He believes that he was doing his job and obeying orders and wants to make this point in court even if he and Downey end up serving a life sentence. Seeing Kaffee as nothing more than a coward for making the deal and trying to avoid fighting the case, Dawson fails to salute him when he leaves the room.
Failing to understand Dawson's stubbornness, Kaffee at first decides to resign from the case, but after thinking things through he agrees to go ahead. He, Galloway and Weinberg work flat out preparing their defense, which involves weeks of intensive research, discussions, planning and rehearsals. However, on the eve of the trial, Kaffee concludes that "We're gonna get creamed!"
The court-martial begins. During the cross-examination of other Marines from Guantanamo, it is established that Code Reds are standard at the base as a means of getting sloppy recruits to follow procedure, such as taking proper care of accommodation and equipment or completing exercises successfully. Santiago was clearly not up to doing any of these and yet was not subjected to a Code Red until the evening of his death. Cpl. Jeffrey Barnes (Noah Wyle), who has also been a victim of a Code Red, claims that Dawson would not have allowed it.
In his post-mortem report, the base physician, Dr. Stone (Christopher Guest), stated that Santiago died as a result of poisons on the rag used to gag him. These caused a condition called lactic acidosis which led to his death. However, Kaffee gets Stone to admit that lactic acidosis could also be caused by other symptoms such as heat exhaustion caused by strenuous exercise. Kaffee then produces a report by Stone after a routine examination of Santiago when he was still alive. It indicates that Santiago had respiratory stress and was supposed to be exempted from such exercises for a while. The fact that he was not exempted means that he could have died of heat exhaustion even if the rag was perfectly clean but that Stone had to cover-up his negligence.
Kaffee's effectiveness as a lawyer strengthens as the trial progresses and he proves to be a tough and clever cross-examiner, impressing even Galloway by the way he handles the proceedings. However, he is under little illusion that his clients are unlikely to be let off. They have never denied assaulting Santiago so the best Kaffee can do is persuade the jury that they did not intend to kill him and that they were acting under orders from Lt. Kendrick.
While cross-examining Kendrick, Kaffee confronts him over the fact that he denied Dawson a promotion after the latter helped out a fellow Marine who had been denied food for several days for stealing liquor from the officers' mess. Under oath, Kendrick denies ever ordering Dawson and Downey to inflict a Code Red on Santiago.
Lieutenant-Colonel Markinson, Jessup's executive officer, who has gone AWOL since the incident, resurfaces in Kaffee's car half-way through the trial. When Kaffee was in Cuba, Jessup told him that Santiago was due to be transferred off the base for his own safety but Markinson now reveals that that was a lie and that transfer orders were created as part of a cover-up long after Santiago's death. Jessup wanted Santiago to stay on the base in order to be "trained".
A flashback scene shows a meeting between Jessup, Markinson and Kendrick, set on the morning prior to Santiago's death. Jessup was annoyed at the fact that Santiago went above the chain of command when reporting Dawson to the NIS for shooting at the Cuban guard and was not up to doing the tough exercises required at the base. Markinson advocated that Santiago be transferred immediately for safety reasons - the other marines would take revenge for his snitching on Dawson - but Jessup vehemently refused on the grounds that this would set a bad precedent which could weaken their defenses and cost lives. He even made a grand show of suggesting that sending Santiago back would mean that every other marine on the base would also be sent back to the States. He decided that officers have a responsibility to ensure that all personnel are trained appropriately and that Santiago should stay for "training". Jessup ordered Kendrick to ensure that Santiago show significant improvement on the next evaluation report or he would be held personally responsible. When Markinson objected, Jessup berated and demeaned him for questioning his decisions in front of Kendrick, a junior officer, and even implied that Markinson did it out of jealousy for the fact that, although they graduated in the same year and had similar careers, Jessup still outranked him.
Back in the present, Markinson also states that Santiago could have left the base in a plane on the evening of his death, rather than the following day as Jessup had claimed. Kaffee is unable to find evidence of the earlier flight in the log book from the Guantanamo airfield. Markinson believes that Jessup has been covering his tracks.
Back in court, evidence comes up which questions whether Kendrick ordered Dawson and Downey to carry out the Code Red, something the defense has always taken for granted. It now emerges that Downey was on guard duty and not in the barracks at the time when Kendrick supposedly gave the order to Dawson. Thus it is the word of Dawson, who had a personal grievance towards Santiago, against that of Kendrick, a highly-decorated, God-fearing officer.
Kaffee wants Markinson to testify but rather than publicly dishonor himself and the Marine Corps, Markinson sends a letter to Santiago's parents, blaming his own weakness for the loss of their son, dresses in full dress uniform and commits suicide.
Without Markinson's crucial testimony, Kaffee believes that the case is lost and gets drunk. Galloway tries to convince him to summon Jessup to court and confront him. She believes that Jessup ordered the Code Red and that they have to get him to admit it. There is no evidence for this whatsoever and falsely accusing a superior officer of such a felony could result in Kaffee himself facing a court-martial which will ruin his career.
After Galloway storms out, Kaffee reflects on his late father with Weinberg. Weinberg admits that, with the evidence they have, Kaffee's father would never try to blame Jessup, but also says he would rather have the younger Kaffee as lawyer for Dawson and Downey any day. Weinberg pushes his friend to consider if it is he or Lionel Kaffee who is handling the case and Daniel Kaffee finally decides to put Jessup on the stand.
Jessup is summoned to court. Just as Kaffee is about to start his cross-examination, Weinberg arrives with two Airmen from the Andrews Air Force Base which Jessup does not fail to notice. Kaffee initially gets Jessup to confirm that he had arranged for Santiago to be transferred off the base for his own safety and that the earliest flight was in the morning following his death.
Kaffe then questions him over his travel habits. Jessup admits packing sets of clothes, including civilian and military, and various other items. He also admits phoning several friends and relatives in order to meet them while in Washington.
Kaffee then points out that Santiago did none of these things! At the time of his death his clothes were unpacked and still hanging in his closet and, after spending months in desperate and vain attempts to get a transfer, he did not contact anyone or make arrangements to be picked up at the airport.
Kaffee is hoping to show that the transfer order was phony. However Jessup successfully outsmarts him by saying that he cannot speculate on Santiago's habits and he especially belittles Kaffee for pinning his clients' defense on a phone bill. Kaffee is struck dumb by this setback and Jessup is about to leave with a triumphant smug when the young man demands that he be reseated.
Kaffee now asks if Jessup ordered Kendrick to tell the men not to touch Santiago. Jessup confirms this and reconfirms that Santiago was to be transferred in case the men attacked him. Kaffee asks if Kendrick or the men may have questioned the order and decided to take matters into their own hands! Jessup angrily rejects this stating that as front-line troops his men have to obey orders at all times without question! At this moment, Kaffee points out that if Jessup's orders are always obeyed then there was no reason to transfer Santiago at all!
Momentarily stunned, Jessup tries to come up with alternative explanations for Santiago's transfer which are torpedoed by Kaffee who demands to be told the truth, at which point Jessup explodes: "You can't handle the truth!"
Because he defends his country, Colonel Jessup does not see why Kaffee, who has never been on the front line, should even question his methods from "under the blanket of the very freedom I provide". Kaffee should either thank him for protecting his country and his way of life or take up a gun and do it himself. But as the two men shut out their points at each other, Kaffee finally gets an angry Jessup to admit that he did in fact order the Code Red!
At the prompting of Kaffee and the Judge, prosecutor Ross places Jessup under arrest. Jessup is outraged and lashes out at Kaffee, accusing him of weakening the nation. Kaffee simply expresses satisfaction that Jessup will go to jail for the death of Santiago. He later admits to Ross that the Airmen were brought to court as a bluff to make Jessup believe that the defense had evidence of the earlier flight which he covered-up. Kendrick will also be arrested for ordering the Code Red, committing perjury (when he denied doing it) and participating in the cover-up.
Dawson and Downey are found not guilty of murder but are dishonorably discharged for "conduct unbecoming a United States Marine." Downey is confused, pointing out that Jessup confirmed that they were obeying orders, but, after getting over the initial shock, Dawson points out that they failed to stand up for those too weak to stand up for themselves, like Santiago. As the two prepare to leave, Kaffee tells Dawson he doesn't have to be a soldier to have honor. Dawson, who had previously refused to salute Kaffee, who he saw as a coward, now announces "There's an officer on deck!" and they exchange salutes.