BOZEMAN, Mont. — Montana's next congressman, Greg Gianforte, avoided jail time Monday after pleading guilty to assaulting a reporter the day before he was elected.

Gallatin County Justice of the Peace Rick West sentenced the Republican technology entrepreneur to 40 hours of community service, 20 hours of anger management counseling and ordered him to pay a $385 fine for the misdemeanor. If he remains law abiding for 180 days, he can petition for the conviction to be removed from his record.

Gianforte's attorneys noted that he had already paid more than $4,600 in restitution to Guardian reporter Ben Jacobs for the assault, which cast a pall over his May 25 victory to serve the remainder of Ryan Zinke's term. Zinke resigned to become Interior Department secretary.

Gianforte, 56, is expected to be sworn in to the state's sole U.S. House seat later this month.

Jacobs said Gianforte knocked him to the ground when he asked the candidate a question May 24. Audio taken by Jacobs recorded sounds of a scuffle, followed by Gianforte yelling for the reporter to "get the hell out of here." Gianforte was cited that night.

In an attempt to put the matter behind him, Gianforte first settled all civil claims with Jacobs before requesting that Monday's court date cover both his arraignment and sentencing.

In the civil settlement, Gianforte agreed to give $50,000 to the Committee to Protect Journalists and wrote Jacobs a letter of apology in which he acknowledged assaulting the reporter for asking a "legitimate question about health care policy."

In exchange, Jacobs agreed not to sue Gianforte and said he would not object if Gianforte entered a no-contest plea to the criminal charge, which would have allowed Gianforte to concede to the charge without admitting guilt.

But Gallatin County Attorney Marty Lambert said Friday that he had not agreed to any deal in which Gianforte would plead no contest.

Gianforte, who sold the software company he founded to Oracle for $1.8 billion in 2011, won his first political office over Democrat Rob Quist after a short but intense campaign set off by Zinke's appointment to the Cabinet post by President Donald Trump.

The special election drew millions of dollars in donations from across the U.S.