100%—also heavily influenced by Catholic upbringing on this. Related: I can't remember how faithfully Denethor's story is rendered from the books but imo the LOTR films depict well the perils of despair with his character and how it only makes defeat certain. (And how the Palantir can't be trusted!)
Having just reread the books—the books portray a more competent Denethor who’s a born statesman if definitely not a nice guy. But thanks in large part to the palantir melting his brain, he collapses into despair at exactly the time when Minas Tirith most needs a strong leader.