Greg Gianforte, the Montana Republican charged with assaulting a reporter the night before he won a seat in the House of Representatives last month, formally apologized to the reporter on Wednesday and said he would donate $50,000 to a journalism nonprofit as part of a settlement.

Mr. Gianforte wrote in a letter to the reporter, Ben Jacobs of The Guardian, that his actions on May 24 were “unprofessional, unacceptable and unlawful.” In the apology, Mr. Gianforte promised to donate $50,000 to the Committee to Protect Journalists, an advocacy group for press freedoms and journalists’ rights.

“As both a candidate for office and a public official, I should be held to a high standard in my interactions with the press and the public. My treatment of you did not meet that standard,” Mr. Gianforte, 56, who won Montana’s lone seat in the House on May 25, wrote. “You did not initiate any physical contact with me, and I had no right to assault you.”

Mr. Jacobs accepted the congressman-elect’s apology, he said in a statement. “I hope the constructive resolution of this incident reinforces for all the importance of respecting the freedom of the press and the First Amendment and encourages more civil and thoughtful discourse in our country,” Mr. Jacobs said.

The settlement precludes any civil litigation. Mr. Gianforte still faces a misdemeanor charge of assault. If convicted, he would face up to six months in jail and a $500 fine. Mr. Gianforte’s lawyers requested an extension this week to delay his first court appearance.

The episode unfolded at the site of Mr. Gianforte’s final rally in a hotly contested special House election. Before the event in Bozeman, Mont., Mr. Jacobs approached him and asked his thoughts about Republicans’ health care bill. When he pressed for an answer, Mr. Jacobs said, he was “body-slammed.”

“I’m sick and tired of you guys!” Mr. Gianforte told Mr. Jacobs, according to an audio recording by Mr. Jacobs, shortly after the sounds of a physical struggle and a crash. “The last time you came here, you did the same thing. Get the hell out of here. Get the hell out of here.”

Mr. Jacobs replied, “You just body-slammed me and broke my glasses.”

A Fox News crew that witnessed the episode recounted in a first-person report on its website that Mr. Gianforte “began punching the reporter” and “grabbed Jacobs by the neck with both hands and slammed him into the ground behind him.”

The Gallatin County sheriff’s office charged Mr. Gianforte with misdemeanor assault that night. The next day, Mr. Gianforte won the seat, capturing a bit more than 50 percent of the vote to defeat Rob Quist, a Democrat and country music singer.

In his victory speech, Mr. Gianforte conceded that he had “made a mistake,” briefly apologized to Mr. Jacobs and promised Montanans he would not embarrass them again.

Mr. Gianforte earned riches as a technology entrepreneur with his company, RightNow Technologies, which he sold in 2011 to Oracle for about $1.5 billion. He has not held government office before and lost a 2016 race for governor of Montana.