Jimmy Stewart plays Ransom Stoddard, an attorney who believes in law and order, and refuses to carry a gun. John Wayne is Tom Doniphon, a tough western gunslinger (but not a villian, and a friend of Ransom Stoddard), who points out that there is no law, and "A man needs a gun in these parts, pilgrim."
This might be an academic debate between Stoddard and Doniphon, but Lee Marvin is the no-good outlaw Liberty Valance who only knows the law of the gun, whose only way to settle differences is with violence.
The movie explores the "odd couple" relationship between Stoddard and Doniphon, and how the question of Liberty Valance is settled.