There is no law that requires members of Congress to give up their seats when convicted of a felony. But Mr. Collins had faced intense pressure from members of his own party to not seek re-election after his indictment last August.

Several Republicans had already announced plans to run in the primary election: two state senators, Chris Jacobs and Robert Ortt, as well as Beth Parlato, a lawyer and former judge. Republican Party officials, including the state party’s chairman, Nick Langworthy, had suggested that they would like to see a candidate other than Mr. Collins run.

In addition, Nate McMurray, the Democratic town supervisor of Grand Island, which is just north of Buffalo, has declared his plans to run again. Mr. McMurray lost by less than half a percentage point last year, even though the district had voted for President Trump over Hillary Clinton by a margin of almost 25 points.

But Mr. Collins had defied calls to step aside, refusing to say whether he would seek another term. He transferred $500,000 of his own money into his campaign fund in June. Aside from that money, he had raised just $14,000 in the first six months of this year.

In 2017, by contrast, Mr. Collins received more than $500,000 in contributions in the same period.

After news of Mr. Collins’s resignation broke, the Cook Political Report, a nonpartisan election tracker, changed Mr. Collins’s district from a rating of “Lean Republican” to “Solid Republican.”