MISSOULA, Mont. — The Republican candidate in a hotly contested special House election in Montana was charged with assaulting a journalist on Wednesday at what was to be a final rally in Bozeman on the eve of the vote. The attack brought police officers to the event and sent the reporter to the hospital for X-rays.

In a statement late on Wednesday, the office of the Gallatin County sheriff, Brian Gootkin, said that there was enough evidence to charge the candidate, Greg Gianforte, with misdemeanor assault. Mr. Gianforte, the Republican candidate for the state’s lone House seat, is scheduled to appear in court before June 7.

It was an extraordinary development in a race that was being closely watched for clues about the national political environment in the tumultuous first months of the Trump presidency.

In a sign of the considerable Republican frustration with Mr. Gianforte, Speaker Paul D. Ryan publicly scolded the candidate and said he should apologize. Mr. Ryan said that the “physical altercation” was inappropriate and “should not have happened.”