Senator Ransom "Ranse" Stoddard (James Stewart) and his wife Hallie (Vera Miles) arrive by train in the frontier town of Shinbone, in an unnamed western state, to attend the funeral of Tom Doniphon (John Wayne). As they make their way toward the undertaker's establishment to pay their respects to the deceased, a reporter (Joseph Hoover) and his editor, Maxwell Scott (Carleton Young) approach and ask Stoddard to explain why a United States Senator would make the long journey from Washington just to attend the funeral of a local rancher.Stoddard's story flashes back 25 years to his arrival in Shinbone as a young, idealistic attorney. His stagecoach is robbed by a gang of outlaws led by Liberty Valance (Lee Marvin). When Stoddard takes Valance to task for robbing a widow of her heirloom, he is brutally whipped and left for dead. When Doniphon finds and brings him into town, restaurant owner Peter Ericson (John Qualen), his wife Nora (Jeanette Nolan), and employee Hallie tend to his injuries, and explain that Shinbone's townsfolk are regularly victimized by Valance. Link Appleyard (Andy Devine), the town marshal, has neither the courage nor the gunfighting skills to challenge Valance; Doniphon (who loves Hallie and plans to ask her to marry him) is the only man willing to stand up to him.When Stoddard, the naive "pilgrim" (as Doniphon dubs him), opens a law practice in town, Doniphon and many others believe him crazy for inviting retribution from Valance, who cannot abide any challenge to his "authority". Force, Doniphon explains, is the only thing Valance understands; he advises Stoddard to either flee the territory or buy a gun. Stoddard maintains he will do neither; he is an advocate for justice under the law, not brute force. He earns the town's respect by refusing to knuckle under to Valance, and by founding a school to teach reading and writing to illiterate townspeopleâincluding Hallie.When Dutton Peabody (Edmond O'Brien), publisher of the local newspaper, offers him a revolver, however, he accepts it; and when Doniphon sees that he is trying to teach himself to use it, he brings Stoddard to his house for a shooting lesson. During target practice he shoots a hole in a paint can, splattering paint on Stoddard's suit, explaining that this is the sort of trickery that he can expect from Valance. Infuriated, Stoddard punches him in the jaw and leaves.Shinbone's residents meet to elect two delegates for a statehood convention at the territorial capital. Doniphon nominates Stoddard for one of the positions, because he "knows the law, and throws a mean punch". Stoddard addresses the group, explaining that statehood will benefit the people of the territory through improvements in infrastructure, safety, and education. The area's cattle barons, who oppose statehood and the new regulations that it would bring, hire Valance to sabotage the effort. He interrupts the meeting and attempts to bully the townspeople into electing him as a delegate, but Stoddard defies him yet again. The townspeople elect Stoddard and Peabody, prompting Valance to challenge Stoddard to a gunfight. Doniphon again advises Stoddard to leave town, but Stoddard maintains that he still believes in the rule of law (even though Link will do nothing to help him), and he is willing to risk his life for his principles.That evening, after Valance and his gang (Lee Van Cleef and Strother Martin) assault Peabody and trash his newspaper office, Stoddard goes into the street to face Valance. Valance toys with Stoddard, shooting a pottery vase near his head, and then his right arm, knocking his gun to the ground. He condescendingly allows Stoddard to retrieve his gun. The next bullet, he says, will be "right between the eyes"; but Stoddard fires first, and to everyone's shock, Valance falls dead. Doniphon watches Hallie as she lovingly cares for Stoddard's wounds, then heads for the saloon to drown his sorrows. At his homestead, in a drunken rage, he sets fire to the addition that he has just finished in anticipation of asking Hallie to marry him. His ranch hand, Pompey (Woody Strode), rescues him from the inferno, but the house is destroyed.At the statehood convention, Peabody nominates Stoddard as the territory's delegate to Washington, but his "unstatesmanlike" conduct is challenged by a rival candidate, Maj. Cassius Starbuckle (John Carradine). Stoddard decides that his opponent is right; he cannot be entrusted with public service after killing a man in a gunfight. Seeing Stoddard's reluctance, Doniphon takes him aside and confides that he, Doniphon, actually killed Valance from an alley across the street, firing at the same time as Stoddard. Doniphon explains that he knows Hallie loves Stoddard; he shot Valance to secure her happiness. Reinspired, Stoddard returns to the convention, accepts the nomination, and is elected to the Washington delegation.The flashback ends, and Stoddard fills in the intervening years: He married Hallie, and then, on the strength of his reputation as "the man who shot Liberty Valance", became the first governor of the newly minted state. He then served as U.S. Senator and Ambassador to Great Britain before returning to the Senate, and now he's the odds-on favorite to become his party's nominee for vice president. Scott now understands that Stoddard's entire reputation is based on a legend; but after reflection, he throws his interview notes into the fire. "This is the West, sir," he explains. "When the legend becomes fact, print the legend." On the train back to Washington, Stoddard informs Hallie, to her delight, that he has decided to retire from politics and practice law in Shinbone. When Stoddard tells the train conductor (Willis Bouchey) that he will write to railroad officials, thanking them for their many courtesies in expediting his trip back to Washington, the conductor replies, "Nothing's too good for the man who shot Liberty Valance!"
Output: Question: What did Stoddard earn from the town for not backing down from Valance?, Answer: Respect