In the Upper Peninsula of Michigan, small-town lawyer Paul Biegler (James Stewart), a former district attorney who lost his re-election bid, spends most of his time fishing, playing the piano and hanging out with his alcoholic friend and colleague Parnell McCarthy (Arthur O'Connell) and sardonic secretary Maida Rutledge (Eve Arden).
One day Biegler is contacted by Laura Manion (Lee Remick), wife of the loutish US Army Lieutenant Frederick Manion (Ben Gazzara). The Lieutenant has been arrested for first degree murder, that of innkeeper Barney Quill. Manion does not deny the murder but claims that it was committed because his wife was raped and beaten by Quill.
Even with such a motivation, it would be difficult to get Manion cleared of murder, so Biegler pushes him into a position where he claims to have no memory of the event, thus giving them a chance of winning his freedom on the grounds of "irresistible impulse", a version of a temporary insanity defense.
As he sets about preparing his case, Biegler catches Laura Manion flirting with other army officers during a roadhouse party. He has to practically order her to stay away from "men, juke joints, booze, and pinball machines" and wear a girdle in order to play the part of a "meek little housewife" rather than that of a happy-go-lucky party girl. She also agrees to give up her tight-fitting clothes and wears a formal dress, glasses, a hat and a woman's suit in court.
Biegler's folksy speech and laid-back demeanor hides a sharp legal mind and a propensity for courtroom theatrics that has the judge busy keeping things under control. However, the case for the defense does not go well, especially since the local D.A. (Brooks West) is assisted by a high-powered big city prosecutor named Dancer (George C. Scott). Furthermore, the prosecution goes all the way to block any mention of Manion's motive for killing Quill - the raping of Laura. Biegler eventually manages to get the rape issue into the record and Judge Weaver (Joseph N. Welch) agrees to allow the matter to be part of the deliberations. However, Dancer's cross-examination of Laura effectively portrays her as a woman who was not satisfied with her marriage and openly flirted with other men, including the one she claimed raped her.
A doctor casts doubt on whether she was raped or not, though Biegler questions the method he used to obtain the results, and psychiatrists give conflicting testimony to Manion's state of mind when he killed Quill. Furthermore it comes out that even Lt. Manion doubted his wife, as Laura, a Catholic, had to swear on a rosary to persuade her husband that the sex with Quill was indeed non-consensual.
Quill's inn is due to be inherited by Mary Pilant (Kathryn Grant), a mysterious Canadian who is suspected of being his mistress. Biegler's friend and colleague Parnell McCarthy makes inquiries and discovers that she is in fact Quill's daughter but is anxious to keep this secret since she was born out of wedlock. Biegler, who is losing the case, tries to persuade her that Al Paquette (Murray Hamilton), a bartender who witnessed the murder, knows that Quill raped Laura but is covering this up, either out of love for Mary or loyalty to his late friend. Through Mary, Biegler tries to persuade Paquette to testify for the defense on these grounds but he refuses. Annoyed, Biegler leaves saying: "I'll leave a pass for you and Al at the trial. You might like to watch Lt. Manion get convicted."
Mary does actually attend the final day of the trial when the issue is raised about the panties that Laura was wearing on the night of the murder. These panties were never found at the spot she claims the rape took place. Mary, who was unaware of this, later returns to testify that she found the panties in the inn's laundry room, presuming that Quill dropped them down the laundry chute when he returned home. Dancer insistently quizzes her that she is lying, that Quill was her lover and that she is trying to get Manion off the hook out of jealousy of Quill having a relationship with another woman. Mary shocks the court and torpedoes Dancer by stating that Quill was her father.
Biegler has played heavily on the issue that he is "just a humble country lawyer" facing a "brilliant prosecutor from the big city of Lansing", a factor which has played well with the jury. After the closing speeches however, he privately admits that Dancer delivered the "best summary I've ever heard in a courtroom". It is to no avail though: Manion is found "not guilty for reason of insanity".
The next day Biegler and McCarthy go to see the Manions at their trailer park home in order to collect their fee only to find the trailer missing. A note left by Manion tells Biegler that he was "seized by an irresistible impulse" the defense used by Biegler during the trial. Evidence left lying around indicates that Manion was actually a heavy drinker who beat Laura before they left. This might indicate that Laura's sexual encounter with Quill was consensual and that Manion killed Quill out of drunken jealousy.
Biegler does obtain some "poetic justice" by being the attorney appointed to administer Barney Quill's estate.