The Killing Time
(1987)

Sam (Beau Bridges), a sheriff of a small town, plans to help his lover Laura (Camelia Kath) murder her abusive husband Jake Winslow (Wayne Rogers) and blame it on an arriving Sheriff's deputy. Unbeknown  to either of them a psychotic drifter (Kiefer Sutherland) murders the deputy "Brian Mars" and takes his identity. The drifter has his own score to settle with Jake Winslow, as he framed his father for embezzlement that led to his suicide.

The drifter learns of the plot to frame him, but kills Jake anyway to avenge his father and leaves evidence pointing to Sam. The Drifter confronts Sam with the intention of killing him and Laura for their planning to frame him. The Drifter gets the drop on Sam but is killed by Carl (Joe Don Baker), Sam's deputy who tracked them down after finding out that the real Brian Mars was murdered.

Sam, realizing he is no longer fit to be a cop, resigns and leaves the job to Carl. Sam leaves with Laura to hopefully start a better life.

Thanks Spectre!