Death of a Gunfighter
(1969)

According to IMBD, this is the movie that first started the tradition of attributing a movie to "Allen Smithee", when the director did not want his name used.

In the early 1900's, the town of Cottonwood Springs wants to move from its old west past into the modern age.  Marshall Frank Patch (Richard Widmark) was guaranteed a job for life, when he was hired in the 1880s to rid the town of roughnecks.   Now the town fathers see him as an outdated and embarrassing relic, and  want to get rid of him.  A drunken lowlife goes gunning for the marshall in revenge for something 16 years ago.  Patch shoots the man in self defense, giving the town council an excuse to get rid of Patch.

When the town council tell Patch, he refuses to go along, insisting on their guarantee that the job was his for life.  Patch knows some dark secrets from when the town was rougher, and the council fear he may talk.  They want him dead.  Mr Oxley goes after Patch with a rifle.  Oxley loses his nerve and kills himself.  Lester Locke (Carroll O'Connor) goads Oxley's son into going after Patch.  There is a shootout, and Patch kills the son.  The dying son begs to know his father's secret.  Patch reveals that Oxley shot a man in the back, but was spared hanging when he agreed to raise the son as his own (so the dying boy's real father was killed by Oxley).

Locke recruits 3 of the town low life's to go after Patch.  Patch kills 2, but the third shoots Patch.  Thinking Patch is dead, Locke shoots his accomplice in the back, so there will be no witness to Locke's involvement.  Patch just got grazed on the shoulder.  He lassos Locke and drags him across town to lock him in the jail.  In the middle of all this, Patch asks Clara Quintana (Lena Horne), the saloon keeper, to marry him.  They are immediately married by the preacher.  Walking home from the church, Patch thinks it is all over.  The whole town council all come out with rifles, and open fire at once.  Patch is gunned down in the middle of the street.

Thanks Joseph C!