NEW YORK -- Dallas Mavericks point guard Raymond Felton pleaded guilty Wednesday in a New York gun case, taking a plea deal that involved admitting a felony but spares him jail.

Felton pleaded guilty to attempted criminal possession of a weapon and criminal possession of a firearm. He admitted he knowingly had a large-capacity ammunition magazine and a semi-automatic pistol without a license.

"Are those charges true?" Manhattan state Supreme Court Justice Larry Stephen asked.

Raymond Felton, who was traded by the Knicks to the Mavericks last month, took a plea deal that involves admitting a felony but spares him jail time. Robert Hanashiro/USA TODAY Sports

"Yes, sir," Felton said, later adding in a soft voice: "I apologize. I realize what I did was wrong."

He was immediately sentenced to 500 hours of community service and ordered to pay a $5,000 fine. Manhattan Assistant District Attorney Jonathan Rebold said Felton will be allowed to do the service outside New York.

If he complies, the case will be closed without jail time or probation.

"At this point, Raymond is looking forward to starting the next chapter of his life and focusing on success in Dallas," his lawyer, James Walden, said after court.

The criminal case arose last winter, as Felton grappled with the breakup of his marriage and navigated a struggling season with the New York Knicks. He was traded to Dallas last month, two days after his plea plan was announced.

The team declined to comment Wednesday.

About a week after Felton's law student wife filed for divorce, her attorney brought a loaded semi-automatic handgun to a police precinct and said it was Felton's and she wanted it out of the house, authorities said. Walden has said Felton never threatened anyone with the gun.

After police contacted Felton, he turned himself in shortly after a Mavericks-Knicks game at Madison Square Garden.

Felton was charged under a state law that bans many large-capacity ammunition magazines. Prosecutors said Felton's could hold about 20 rounds.

The NBA, which has said it is monitoring the case, had no immediate comment Wednesday. The league usually waits until criminal cases against players are resolved before deciding whether to impose any fine or suspension.

Felton, 30, was a star at the University of North Carolina and was the fifth pick of the 2005 NBA draft. Besides Dallas and New York, he's played for the Charlotte Bobcats, Denver Nuggets and Portland Trail Blazers.

Last season, Felton missed 17 games while battling injuries and averaged a career-low 9.7 points as the Knicks went 37-45 and missed the playoffs.