UFC star Conor McGregor has avoided jail time – and possible US immigration troubles – by pleading guilty to a single, misdemeanour charge for his involvement in a violent incident in New York earlier this year.

The spirited 30-year-old entered a plea deal in Brooklyn criminal court that saw his two felony charges reduced to a single misdemeanour. He was sentenced to five days of community service and anger management classes.

The plea deal had reportedly been in the works since Mr McGregor’s last court appearance in June, after which the usually headline-grabbing star appeared to be on his best behaviour.

“I just want to say I'm thankful to the DA and the judge for allowing me to move forward,” McGregor said, standing outside court on Thursday. “I want to say to my friends, my family, my fans, thank you for the support.”

The fighter and his entourage then rushed to a waiting SUV, separated by bike-rack barricades from dozens of photographers and reporters. A small contingent of the Dublin native’s fans were easily identified by their accents, and by an Irish flag draped around one of their necks.

Conor McGregor returns to court - in pictures Show all 12 1 /12 Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures NEW YORK, NY - JUNE 14: Conor McGregor arrives at Brooklyn Criminal Court in Brooklyn on June 14, 2018 in New York City. (Photo by Raymond Hall/GC Images) GC Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor arrives at Brooklyn Supreme court in New York on June 14, 2018, for his hearing stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor leaves Brooklyn Supreme court in New York on June 14, 2018, after his hearing stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor leaves Brooklyn Supreme court in New York after his hearing on June 14, 2018, stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) Getty Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor leaves Brooklyn Supreme court in New York on June 14, 2018, after his hearing stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor arrives at Brooklyn Supreme court in New York on June 14, 2018, for his hearing stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor arrives at Brooklyn Supreme court in New York on June 14, 2018, for his hearing stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor leaves Brooklyn Supreme court in New York after his hearing on June 14, 2018, stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor arrives at Brooklyn Supreme court in New York on June 14, 2018, stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor arrives at Brooklyn Supreme court in New York on June 14, 2018, stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor arrives at Brooklyn Supreme court in New York on June 14, 2018, stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images Conor McGregor returns to court - in pictures Conor McGregor returns to court - in pictures Mixed martial arts fighter Conor McGregor leaves Brooklyn Supreme court in New York after his hearing on June 14, 2018, stemming from his April attack on a bus at Barclays Center. (Photo by TIMOTHY A. CLARY / AFP) (Photo credit should read TIMOTHY A. CLARY/AFP/Getty Images) AFP/Getty Images

Mr McGregor was charged with three counts of assault and one count of criminal mischief in April in connection with a backstage melee at the nearby Barclays Center. Footage of the incident, which went viral, appeared to show Mr McGregor throwing a trolly at a bus carrying fellow fighters after a news conference for UFC 223.

The UFC, the sport’s premier organising body, said one fighter was hit by the trolly as it flew through the window, while another suffered a cut to his eye after the glass shattered. At the time, McGregor was angry that the UFC had stripped him of the lightweight title, according to profanity-laced messages he posted on Twitter.

Mr McGregor initially faced up to 7 years of jail time and possible threats to his American visa if convicted on all counts. His plea on Thursday spared him jail time and immigration woes, but also opened him up to the possibility of civil suits over the incident, according to legal experts.

Mr McGregor was also ordered to pay for damages to the bus.

Conor McGregor court news: UFC star breaks silence after returning to New York following bus attack incident

Fellow fighter Cian Cowley, also charged in the incident, was ordered on Thursday to perform three days of community service and attend anger management classes.

The Associated Press said the charges to which the two men pleaded guilty were technically violations, which means they will have no criminal record. However, if they violate the terms of their agreement, they could be sentenced to 15 days in jail.

CBS said a spokesperson for the Brooklyn district attorney’s office called it “a fair resolution that holds the defendant accountable, ensures restitution for the victims and requires the defendant to perform community service where he can reflect on his conduct and give back to society".

Mr McGregor is now free to pursue a return to the UFC octagon. High on the list of potential opponents is Khabib Nurmagomedov – a fighter who was inside the bus on the night of the attack.