A western New York man convicted of leaving menacing phone messages for two Republican members of Congress was sentenced in federal court on Thursday to five years in prison, the second legal development in the region this week involving ominous phone calls to public officials.

The man, Carlos Bayon, 64, was found guilty in July of retaliating against a public official and making interstate threats for identical messages left at the state offices of Representatives Steve Scalise of Louisiana, the No. 2 House Republican, and Cathy McMorris Rodgers of Washington.

In the messages, both of which were left on June 30, 2018, Mr. Bayon alluded to revenge against the Republican lawmakers over the Trump administration’s immigration policies, according to court filings.

“Hey listen,” Mr. Bayon said on the calls, according to a criminal complaint, “this message is for you and the people that sent you there. You are taking ours, we are taking yours. Anytime, anywhere. We know where they are. We are not going to feed them sandwiches, we are going to feed them lead. Make no mistake, you will pay.”