Former Representative Richard L. Hanna, a moderate Republican from upstate New York who was so disenchanted with Donald J. Trump in 2016 that he broke with his party and endorsed the Democrat Hillary Clinton for president, died on Sunday at a hospital near Utica, N.Y. He was 69.

His family said in a statement that the cause was cancer.

Mr. Hanna, who had built a successful construction business before his election to Congress in 2010, represented a sprawling district that stretched from Lake Ontario to the Pennsylvania border.

A quiet backbencher with an independent streak, he stood out for his moderate views at a time when the Republican Party had lurched to the right. He supported abortion rights, same-sex marriage and the Equal Rights Amendment. He opposed cutting federal funding for Planned Parenthood.

After just three terms in Congress, he announced in December 2015 that he planned to retire, saying he wanted to spend more time with his wife and young children.