Jim Dancer, Randolph Scott, is a former Quantrill raider and a close ally of Jesse James, Dale Robertson. They take part in the brutal Lawrence Massacre, during which Dancer shoots Theodore Slocum, Barry Kelley, after mistaking him for his brother Bert Slocum, the man responsible for the death of Dancer's own brother. Theodore Slocum's daughter Evelyn Slocum, Joan Taylor, witnesses the killing and learns Dancer's name but cannot later recognise him. After the Civil War ends, Dancer becomes a wanted outlaw and is eventually captured by detective George Cummings, James Millican. Dancer learns from Cummings that he killed the wrong Slocum. While they are crossing a river by ferry near Lanyard, Kansas, the boat is hit by a storm surge which panics the horses. Cummings is hit by a hoof and falls overboard, taking Dancer with him as they are handcuffed together. Cummings drowns and Dancer, still shackled to him, collapses on the riverbank.
They are found by Lanyard citizens next day, including gambler Dave Oldham, Victor Jory, and saloonkeeper Florence Peel, Jane Nigh. Dancer says he is Cummings and that his captive has drowned. Dave and Florence know he is lying but stay quiet for the present. As Cummings, Dancer retires from the detective agency and becomes a railroad worker. He is in Lanyard when the line is completed and discovers that his enemy Bert Slocum is the town boss who owns most of the property there. When a group of cowboys go on the rampage and try to assault Evelyn, Dancer is obliged to outdraw and kill the ringleader. The townsfolk plead with him to become Town Marshal but he refuses. Dave and Florence confront him and tell him they know he is not Cummings so he agrees to take office.
Aided by his psychotic associate Johnny Tancred, Bill Williams, Slocum sets about trying to monopolise the town and its surrounding territory including the railroad run by Charles Lanyard, the town's founder. Slocum is suspicious of the Marshal and summons Cliff Bailey, Berry Kroeger, a Chicago detective who knew Cummings, to identify him. Bailey is an old friend of Dave Oldham who tells him the full story and, realizing that Slocum is crooked, Bailey confirms that the Marshal is George Cummings.
Dancer's cover is blown, however, when he is recognised by an outlaw called Yancey, Paul Fix who is a former Quantrill man. Dancer is obliged to resign and Tancred takes over as Marshal, releasing Yancey and his friends from jail. They kill Oldham and other leading citizens. Dancer is arrested and Tancred, encouraged by Slocum, stages a kangaroo court trial which ends with Dancer being "sentenced" to hang for the murder of Slocum's brother. Tancred and Yancey tell Slocum they are going to rob his bank and leave the town, so Slocum will be bankrupt.
Meanwhile, Charles Lanyard has had a similar idea and has taken steps to deal with Slocum by hiring the James–Younger Gang to rob the bank. The gang arrive as Dancer is being led down the main street to a hanging tree. Tancred realises they have no rope and shouts for one. Jesse James rides forward with his rope. A shootout begins after Yancey recognises James. Slocum, Tancred and Yancey are all shot dead.
James invites Dancer to join his gang but Dancer declines. James tells him they are equal now after Dancer once saved his life and the gang ride away. Dancer has realised that Florence loves him and the finale shows them hurrying towards each other.