BOZEMAN, Mont. (Reuters) - A Montana Republican congressman-elect pleaded guilty on Monday to assaulting a reporter and was ordered to perform community service and receive anger management training.

Slideshow ( 7 images )

Greg Gianforte, a wealthy former technology executive who campaigned on his support for President Donald Trump, attacked a reporter on May 24, the day before he won a special election to fill Montana’s lone seat in the U.S. House of Representatives.

Gallatin County Judge Rick West sentenced Gianforte to 40 hours of community service and 20 hours of anger management classes.

The judge in Bozeman, Montana, also handed down a six-month deferred jail sentence, allowing Gianforte to avoid time behind bars if he complies with the court’s orders.

Ben Jacobs, a political correspondent for Britain’s Guardian newspaper, said Gianforte “body-slammed” him, breaking his eyeglasses, when the reporter posed a question about healthcare during a campaign event in Bozeman.

The altercation has been portrayed as a sign of the toxicity that has infused American politics. Critics of Trump say his strident criticism of the media has encouraged violence against journalists, while some of the president’s supporters say reporters in general are unfair in their coverage.

“This was not a proud moment, but I’m ready to move on and we have a lot of work to do in Washington,” Gianforte, who is expected to be sworn in later this month, said outside court.

Last week Gianforte apologized to Jacobs in a letter, and he sent a $50,000 check to the Committee to Protect Journalists. In return, Jacobs pledged not to sue him.

“I am confident that he will be a strong advocate for a free press and the First Amendment,” Jacobs said in court on Monday. “And I even hope to be able to finally interview him once he has arrived on Capitol Hill.”

Gianforte apologized to Jacobs again in court and said he looked forward to meeting with him later.

The judge left open the possibility that Gianforte, after completing his sentence, could have the misdemeanor assault charge formally dismissed, Gallatin County Prosecutor Marty Lambert said by phone.

Gianforte initially sought to plead no contest, instead of guilty, but the prosecutor said he insisted on a guilty plea.

“This is the type of case where a defendant just needs to admit to the court what he did, to plead guilty, and he did that,” Lambert said.

Gianforte on May 25 defeated Democrat Rob Quist to fill the House seat vacated when Trump appointed Ryan Zinke as interior secretary.