In hindsight, it’s pretty impressive how enjoyable “Justified’s” fifth season turned out to be, given some of the prominent things that were wrong with it. Yet the season finale of FX’s drama — which has a way of meandering, usually in enjoyable ways — deftly set up a sixth and final season that, as star Timothy Olyphant had telegraphed, will ultimately come down to the central trio of Raylan, Boyd and Ava.

Getting back to those roots (and Spoiler Alert if you haven’t watched as yet) and the long-simmering tensions surrounding Olyphant’s U.S. Marshal Raylan Givens, his boyhood-chum-turned-criminal Boyd (Walton Goggins) and Ava (Joelle Carter), the woman who has bedded them both, takes the series back full circle to season one, and capitalizes on the resourcefulness Boyd has exhibited in surviving this long in the show’s grimy, cutthroat world.

That scenario also not only brings together the parallel tracks that characterized season five (with Boyd and Raylan’s stories operating separately, for the most part, while cleverly intersecting) but helps explain the protracted Ava-in-prison scenario — which at times felt like “Justified’s” less-appealing version of “Orange is the New Black” — as an excuse to have her turn informant against Boyd, a story line with oodles of potential.

Despite consistently being one of FX’s most enjoyable series, “Justified” has gotten by of late by relying on smaller moments and peripheral players, in part because the bad guys weren’t quite as interesting as the galvanizing characters (played by the likes of Margo Martindale and Neal McDonough) who enlivened the show in the past. Simply put, Michael Rapaport’s hillbilly family patriarch — while menacing — didn’t rise to the level of earlier threats other than perhaps the more perilous edges of his accent, although his assorted cast of nitwit relatives was highly entertaining.

Similarly, the program has excelled in casting comic actors in more serious roles (while still using them to extract disarming laughs) as well as conjuring unexpected dynamics, like pairing real-life brothers Steve and Wood Harris as a pair of menacing-yet-amusing enforcers.

Alas, prolific crime author Elmore Leonard — who died last August — didn’t live to see the series, one of the finer adaptations of his work, through to next season’s conclusion. But inasmuch as showrunner Graham Yost has talked about using his blessing as the producers’ guiding light and employing “What Would Elmore Do?” as a writers’ room mantra, season six looks set up to send “Justified” out on a high note.

Ultimately, “Justified” has always played like a classic western outfitted in modern garb. So what better way to end it than with a lawman, an outlaw and, after some protracted shenanigans, an old-fashioned showdown?