Deputy Sheriff Lou Ford (Casey Affleck) is a pillar of the community in his small west Texas town, patient, dependable, and well-liked. Beneath his pleasant facade, however, he is a sociopath with violent sexual tastes. As a teenager, Lou was caught raping a five-year-old girl by Mike, his older step-brother. Mike pleaded guilty to the crime and served prison time to protect Lou. After being released, Mike was hired by the construction firm of Chester Conway (Ned Beatty). One day on the job, Mike had a fatal accident. Lou believes that Conway planned the accident.
At the prodding of Sheriff Bob Maples (Tom Bower), Lou visits Joyce Lakeland (Jessica Alba), a prostitute who is having an affair with Conway's son, Elmer (Jay R. Ferguson). When Joyce objects to Lou's treatment of her and slaps him, he throws her on the bed and uses his belt buckle for a spanking until her buttocks are bruised and bleeding. Joyce enjoys pain, and she and Lou begin a passionate love affair.
Joyce suggests that Lou would never leave town with her, but they devise a plot to extort $10,000 from the Conways. Sheriff Maples and Chester Conway ask Lou to oversee the payoff. Lou has another plan: He viciously beats Joyce, intending to kill her. When Elmer arrives, Lou shoots and kills him. He then plants the gun on Joyce, hoping to make the scene look like a murder/suicide. Joyce survives, however, and Conway announces his intention to see her executed for killing Elmer.
Lou's reputation begins to falter: His longtime girlfriend, Amy (Kate Hudson), suspects he is cheating on her, and the county district attorney, Howard Hendricks (Simon Baker), suspects that Lou could be behind the murders. Lou is asked to join Sheriff Maples and Conway in taking Joyce to a hospital in Fort Worth where doctors can operate on her; Conway wants her alive so he can interrogate her as soon as possible. Lou waits in a hotel room while the surgery takes place. A shaken Maples arrives to tell him that Joyce died on the operating table. Lou and Maples return to west Texas by train.
While browsing his father's books at home, Lou discovers some nude photographs of a woman that were hidden in a Bible. The woman was Helene, a housekeeper and babysitter in his youth who bears a strong resemblance to Joyce. Lou recalls that Helene introduced him to sadomasochism, urging him to strike her and proclaiming that she loved pain. Lou burns the photos.
Hendricks arrests a local youth, Johnnie Pappas (Liam Aiken), as a suspect in the murders of Elmer and Joyce. He was found with one of the $20 bills Elmer was to give Joyce in the payoff; Conway had the bills marked in order to blackmail Joyce if she didn't leave town. Because Lou is close to Johnnie, Hendricks asks Lou to persuade him to confess. But it was Lou who had given Johnnie the marked $20 bill after taking it from Elmer. Lou confesses to Johnnie, who promises to protect him. Lou hangs Johnnie, making it look like a suicide.
Johnnie's death only makes the town more suspicious of Lou. Journalist and union organizer Joe Rothman (Elias Koteas) implies that he knows Lou killed Elmer and Joyce and suggests Lou leave town. Amy persuades him to elope and acquiesces to his desire to spank her roughly in bed. At first Lou is satisfied, but his homicidal urges begin to resurface and he contemplates killing Amy.
An alcoholic bum whom Lou had previously brutalized (Brent Briscoe) says he knows Lou committed the murders and expects $5,000 to keep quiet. Lou asks him to come back in two weeks, when he and Amy plan to elope. That day, Lou beats Amy to death, then chases the bum down the street, accusing him of the crime. The bum is killed by another deputy, Jeff Plummer (Matthew Maher).
The next morning, Plummer appears on Lou's porch to tell him that Maples committed suicide, heartbroken over Lou's crimes. Hendricks and Plummer try to get a confession from Lou, who cockily refuses. They have a letter that Amy intended to give him before they eloped, in which Amy begs him to come clean. Lou is arrested and sent to an insane asylum.
After a few weeks, a slick lawyer, Billy Boy Walker (Bill Pullman), has him released and drives him home. Knowing that the authorities probably have evidence against him and that the evidence could only be Joyce, who did not die after all Lou begins to plot his own death.
Joyce, now able to walk but still bearing the scars of that brutal night, is brought to Lou's house. She tells Lou that she refused to cooperate with the authorities because she loves him. Lou says he loves her, too and then stabs her. Plummer opens fire, igniting the gasoline and alcohol Lou has spread around the house and causing an explosion that kills everyone inside.