Washington (CNN) -- Suspended NBA star Gilbert Arenas was sentenced to two years of supervised probation Friday for bringing guns into his team's locker room.
He also is to serve 30 days in a halfway house. He will be required to serve 400 hours of community service and contribute $5,000 to a fund for victims of violence.
The Washington Wizards guard avoided jail time when, after hearing Arenas' personal apology, a clearly conflicted Superior Court Judge Robert Morin reluctantly rejected government prosecutors' recommendation for a three-month jail term.
Arenas addressed the court without notes and appeared to be fighting back tears.
"I'm very sorry that this all happened," Arenas told the court. He said he is misunderstood because of his desire to be light-hearted and joke. He also referenced a photo of him taken during a pre-game huddle days after the incident in which he used his hands to mimic firing guns.
"That picture where I was pointing my finger [like a gun] I thought the 14 or 15 players are laughing together for maybe the last time. I like to make people laugh. That's who I am," Arenas told the court.
Morin was not amused. He sternly upbraided Arenas for illegally bringing guns into the Wizards locker room in violation of D.C. laws. He also was suspended indefinitely by the NBA for the incident.
"It was stupid," Morin told Arenas. The judge also blasted Arenas for taunting teammate Javaris Crittenton by threatening to shoot him and then trying to hide the truth from investigators. "You were very seriously mistaken," Morin said.
The veteran point guard and former NBA all-star was the top scorer for the Wizards, averaging 22.6 points per game before his suspension. He pleaded guilty on January 15 to illegally bringing four guns into the team's locker room during an ongoing dispute with teammate Crittenton over money in a poker game.
Arguing unsuccessfully for jail time, prosecutor Chris Cavenaugh said that it "would send the wrong message to the youth that if you have a leveraged position you can get by."
In an hour-long defense, Arenas' attorney Kenneth Wainstain countered that the government had singled out Arenas for punishment because he was "a big fish" and argued "no one should be treated worse because they are rich and famous."
After weighing what he saw as pros and cons of issuing jail time, Morin finally came down in favor of Arenas -- but with strings. He ordered a half-way house stay for a month and warned the community service "won't be basketball clinics. They'll be telling youths about the dangers of gun violence."
Then, changing tone, Morin concluded. "You have shown genuine remorse. At your core you're a decent person. You're a good person, and you 'get it,' " the judge said.
After the hearing, Waistein spoke for his client. "Mr. Arenas is grateful to the court and looks forward to serving the community and once again being a force for good in the District of Columbia," he said.
U.S. Attorney Ronald Machen saw it differently.
"Mr Arenas is now a convicted felon, which should serve as a reminder that those who illegally possess firearms in the city, no matter who they are, will be held accountable," Machen said.
In the memo, Arenas' lawyers say those who know him depict him as an "offbeat, but fundamentally very decent" man.
"Despite a history of pranks and misguided practical jokes, he is a peaceful man who is not aggressive or confrontational in any way," according to court documents released by Arenas' attorneys.
CNN's Paul Courson, Terry Frieden, and Alan Silverleib contributed to this report