"The Good, the Bad and the Ugly" is the third installment in Sergio Leone's "Dollars Trilogy," following "A Fistful of Dollars" (1964) and "For a Few Dollars More" (1965). It is set during the American Civil War and follows three gunslingers who are in search of buried Confederate gold.