The film covers the court-martial of two U.S. Marines, Lance Corporal Harold Dawson and Private Louden Downey, who killed a fellow Marine, Private William Santiago, at the Guantanamo Bay Naval Base in Cuba. Santiago compared unfavorably to his fellow Marines, had poor relations with them, and failed to respect the chain of command in attempts at being transferred to another base. An argument evolves between base commander Colonel Nathan Jessup and his officers: while Jessup’s executive officer, Lieutenant Colonel Matthew Markinson, advocates that Santiago be transferred immediately, Jessup regards this as akin to surrender and orders Santiago’s commanding officer, Lieutenant Kendrick, to train Santiago to become a better Marine.
When Dawson and Downey are later arrested for Santiago’s murder, naval investigator and lawyer Lieutenant Commander JoAnne Galloway suspects they carried out a “code red” order, a violent extrajudicial punishment. Galloway asks to defend them, but instead, the case is given to Lieutenant Daniel Kaffee, an inexperienced and unenthusiastic U.S. Navy lawyer. Initially, friction exists between Galloway, who resents Kaffee’s tendency to plea bargain, and Kaffee, who resents Galloway’s interference. Kaffee and the prosecutor, his friend Captain Jack Ross (USMC), negotiate a bargain, but Dawson and Downey refuse to go along. They insist they were ordered by Lieutenant Kendrick to shave Santiago’s head, minutes after Kendrick publicly ordered the platoon not to touch the would-be victim, and did not intend their victim to die. Kaffee is finally won over by Galloway and takes the case to court.
In the course of the trial, the defense manages to establish the existence of “code red” orders at Guantanamo and that Dawson specifically had learned not to disobey any order, having been denied a promotion after helping out a fellow Marine who was under what could be seen as a “code red”. However, the defense also suffers setbacks when a cross-examination reveals Private Downey was not actually present when Dawson and he supposedly received the “code red” order. Lieutenant Colonel Markinson reveals to Kaffee that Jessup never intended to transfer Santiago off the base, but commits suicide rather than testify in court because he feels that he had failed to do the right thing by protecting a Marine under his command.
Without Markinson’s testimony, Kaffee believes the case lost and returns home in a drunken stupor, having come to regret he fought the case instead of arranging a plea bargain. Galloway, however, convinces Kaffee to call Colonel Jessup as a witness despite the risk of being court-martialled for smearing a high-ranking officer. Jessup initially outsmarts Kaffee’s questioning, but is unnerved when the lawyer points out a contradiction in his testimony: Jessup had stated he wanted to transfer Santiago off the base for his own safety, but if he ordered his men to leave Santiago alone and if Marines always obey orders, Santiago would have been in no danger. Under heavy pressure from Kaffee and unnerved by being caught in one of his own lies, an enraged Jessup extols his and the military’s importance to national security, and eventually reveals that he ordered the “code red”. As he justifies his actions, Jessup is arrested; Kendrick would later be arrested for his perjury.
Soon afterwards, Dawson and Downey are cleared of the murder charge, but found guilty of “conduct unbecoming a United States Marine” and dishonorably discharged. Dawson accepts the verdict, but Downey does not understand what they had done wrong. Dawson explains they had failed to stand up for those too weak to fight for themselves, like Santiago. As the two prepare to leave, Kaffee tells Dawson he does not need a patch on his arm to have honor. Dawson, who had previously shown contempt for Kaffee for not understanding the Marine ethos, recognizes him as an officer and renders a salute.