Lieutenant Junior Grade Daniel "Danny" Kaffee (Tom Cruise), is an inexperienced U.S. Navy Judge Advocate General's Corps lawyer who leads the defense in the court-martial of two Marines, Private First Class Louden Downey (James Marshall) and Lance Corporal Harold Dawson (Wolfgang Bodison), who are accused of murdering a fellow Marine of their unit, PFC William Santiago (Michael DeLorenzo), at the Guantanamo Bay Naval Base in Cuba, which is under the command of Col. Nathan R. Jessup (Jack Nicholson).
Santiago compared unfavorably to his fellow Marines, had poor relations with them and failed to respect the chain of command. He went above his superiors to bargain for a transfer in exchange for blowing the whistle on Dawson for firing a possibly illegal shot towards the Cuban side of the island. When the transfer request is seen by the base's senior commanders, there is a heated argument between Santiago's commanding officer, Lt Jonathan Kendrick (Kiefer Sutherland) who asserts that he can handle the situation, and Jessup's executive officer, Lt. Col. Matthew Andrew Markinson (J.T. Walsh) who casts doubt on Kendrick's ability based on a past incident. Markinson advocates that Santiago be transferred immediately for safety reasons before the request gets out, but Jessup says that this would set a bad precedent which could cost lives. Jessup also states that officers have a responsibility to ensure that all personnel are trained, so he orders Kendrick to ensure that Santiago shows significant improvement on the next evaluation report, or he would be held personally responsible. When Dawson and Downey are later arrested for Santiago's murder, Naval investigator and lawyer Lieutenant Commander Joanne Galloway (Demi Moore) suspects that they were carrying out a "code red": a euphemism for a violent extrajudicial punishment.
Galloway requests to defend them but the case is given to Kaffee, who has a reputation for arranging plea bargains. There is initial friction between them, as she believes he negotiates plea bargains to avoid having to argue in court, and he claims that she is interfering with his handling of the case.
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. Friction immediately develops between Kaffee and Dawson and Downey, the former believing that Kaffee isn't up to the challenge of defending them and the latter guided only by his devotion to being a Marine and his dedication to his superior, namely Dawson.
Despite goading by Galloway and Dawson to allow the trial go to court, Kaffee initially tries to step down as lead counsel for the defense - his argument being that since he cannot prove that any order was given for the assault, making a legal stand simply because he believes the Marines did as they were told was a futile gesture. However his relationship with Galloway strengthens as the trial progresses, as does Kaffee's effectiveness as a litigator.
However, Galloway successfully argues her point of view to Kaffee after Dawson and Downey state they were ordered by Lieutenant Kendrick (under the orders of Jessup) to shave Santiago's head, minutes after Kendrick ordered the platoon not to touch the would-be victim. Santiago's death was actually caused when a rag was shoved into his mouth as a gag. Questioning of the base doctor reveals that Santiago had respiratory stress due to heat exhaustion and that lack of oxygen had caused a condition called lactic acidosis. The condition was accelerated in Santiago's case because of the respiratory problems he'd been experiencing. The doctor, however, maintains that Santiago's death must have been caused by a toxic substance present on the rag stuffed into his mouth, despite Kaffee's presentation of a medical report of the doctor's stating that Santiago was to be given restricted duty until his condition improved.
Kaffee comes to realize that for a legal officer of his limited time and experience to be given such an important case is unusual, and he accepts that he was probably assigned to it due to his reputation for plea bargaining, indicating that someone high up did not want the case to reach court, so he changes his mind and agrees to proceed. Kaffee's suspicions are confirmed when he rejects a plea bargain offer from prosecutor Capt. Jack Ross (Kevin Bacon), who's a friend of Kaffee's. Ross then warns that the government's case against the two Marines is strong and that Kaffee could risk his reputation (including court martial and being discharged from the Navy) for any attempt to smear high-ranking officers in making a futile defense.
In the course of the trial it is established that code reds are standard in Guantanamo Bay as a means of enforcing discipline and getting sloppy Marines to follow procedure. Kaffee especially goes after Kendrick, particularly over the fact that he denied Dawson a promotion after the latter helped out a fellow Marine who was under what could be seen as a code red.
Lieutenant Colonel Markinson has gone absent without leave since the incident, but he resurfaces in Kaffee's car during the trial, revealing that Jessup never intended to transfer Santiago off the base as previously claimed but created the transfer orders as part of a cover-up long after Santiago's death. Kaffee is unable to find evidence corroborating these claims and announces his intention to have Markinson testify. 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 returns home after a drunken stupor, having come to regret that he fought the case instead of considering the plea bargain.
Pvt. Downey is called to the witness stand to testify. Stating that he had heard Kendrick issue the order for the code red, Jack Ross opens his cross-examination. On the day that Kendrick held the meeting of Dawson's squad, Downey had been on duty in a remote area of the base. When he was picked up by one of his comrades, their vehicle had a tire blow out and no spare was available. Downey and his fellow Marine had to double-time back to the base, a run that took them 45 minutes. Arriving back at the base long after the barrack's meeting had adjourned, Downey couldn't possibly have heard Kendrick give the order to punish Santiago. Downey's testimony falls apart and is devastating to the defense.
Galloway however convinces Kaffee to take the great risk to call as a witness Colonel Jessup. Kaffee initially questions Jessup's travel habits versus that of Santiago (who had apparently made no preparations to pack and/or called anyone about leaving the base) in an attempt to argue that the transfer order was never properly conducted. However Jessup successfully outsmarts Kaffee by saying that he cannot speculate on Santiago's habits, and he becomes particularly disdainful of Kaffee (pointing out dismissively that Kaffee pinned his clients' defense on a phone bill) and the court proceedings.
Kaffee then directly accuses Jessup of ordering a code red on Santiago and then cutting Dawson and Downey loose. The prosecution and the judge thunder objections, but Jessup is caught in an awkward situation: he had stated that Santiago was due to be transferred off the base for his own safety in case the other Marines sought retribution, but also stated that Marines are honorable men who always follow orders - thus Kaffee argues that if the other Marines were ordered to leave Santiago alone and always follow orders, then Santiago would have been in no danger whatsoever and thus Jessup's argument that he was to be transferred for his own safety was flawed. Under heavy pressure from Kaffee and unnerved by being caught in one of his own lies, Jessep furiously declares "You can't handle the truth!" and dismisses Kaffee as disrespectful of a Marine doing his duty, ultimately confessing that he did order the code red. As Jessup angrily justifies his actions on the basis of national security, he is arrested by Ross, and there is a verdict of not guilty on the murder charges for Dawson and Downey. Ross informs Kaffee he will now have Kendrick arrested for the same charges faced by Dawson and Downey.
Nonetheless, the two Marines are dishonorably discharged for causing Santiago's death through their "conduct unbecoming a United States Marine." Downey does not understand why they are being given dishonorable discharges, but Dawson accepts the verdict, and explains to Downey 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 need a patch on his arm to have honor. Dawson, who had previously been reluctant to respect Kaffee as an officer, barks "There's an officer on deck!" and salutes Kaffee.