Roughly based on the life story of the historical figure Judge Roy Bean, who proclaimed himself "the Law West of the Pecos". Roy Bean was a true life version of the corrupt sheriff or judge who abuses his position for personal benefit, that is a stock figure in many Westerns. Walter Brennan won an Academy Award for his portrayal of Roy Bean.
Judge Roy Bean is the judge and saloonkeeper in a small west Texas town. His saloon is also his courtroom. He also owns cattle, and uses his power to help the cattle men in their turf wars with the farmers. After one skirmish, he sentences a farmer to hanging for killing a cow. Sentences are carried out immediately with no chance for appeal. Judge Bean is obsessed with actress Lillie Langtry, to the extent that he renames the town Langtry after her.
Cole Harden (Gary Cooper) is a cowboy coming through town, and is accused of stealing the horse he is riding. Bean sentences Harden to be hanged. Harden picks up on Bean's obsession, and pretends that he came from the East and knows Langtry. Because of this, Bean postpones his sentence to hear more stories about Langtry. When the man who sold Harden the horse enters town, and is identified as the real horse thief, Bean is not at all concerned that he was about to hang an innocent man.
Harden becomes romantically involved with Jane, a daughter of one of the homesteading farmers. He tries to act as a mediator between the 2 sides. While the farmers are all at a square dance, the cattle men set fire to their barns and fields. Jane's father dies. Judge Roy Bean admits he was behind the whole plot. Harden resolves to bring Bean to justice. Harden gets appointed sheriff of the next county. As long as Bean stays in his county, Harden can not touch him.
Lillie Langtry is coming to a theater in Harden's county. Bean is determined to go see his idol. To prevent being ambushed, Bean buys every ticket to a performance, so he is the only one in the theater. Before the show, Sheriff Harden enters and tells Bean that he is being arrested. There is a shoot-out, and Harden hits Bean. As Bean is dying, Harden carries him backstage, so he can finally see Lillie Langtry before he dies.
In real life, according to Wikipedia, 78 year old Bean "died March 16, 1903,peacefully in his bed".
Thanks Joseph C!