Charles Oakley speaks with reporters outside the courtroom on Aug. 4. View Full Caption DNAinfo/Maya Rajamani

NEW YORK CITY — Knicks legend Charles Oakley has agreed to stay away from Madison Square Garden for a year as part of a deal he accepted over charges stemming from a high-profile scuffle at the venue earlier this year.

The former player previously opted to go to trial instead of accepting a plea deal, but backtracked on that decision Friday morning — accepting a deal that will see his case sealed and dismissed after six months if he isn’t arrested during that time and steers clear of the Garden for a year.

Outside the courtroom, Oakley continued to maintain he did nothing to merit being forcibly removed from MSG by security in February.

He had faced charges including assault, aggravated harassment and criminal trespass after getting into an altercation with Garden staff during a Knicks-Clippers game.

Soooooo Charles Oakley just got into a fight at he Knicks game. pic.twitter.com/klZBD89VI7 — Ian Schafer (@ischafer) February 9, 2017

“Like I said from day one, I wasn’t wrong,” Oakley told reporters. “Everybody who seen it, they know what happened. It’s just wrong.”

Going to trial would have meant appearing in court every day “for no reason, and the taxpayers losing money,” he added.

Oakley and his attorney, Alex Spiro, had previously argued the incident escalated because Knicks owner James Dolan had a personal vendetta against the former player. Spiro on Friday said the entire debacle resulted from a “personal issue between [Oakley] and Mr. Dolan.”

“The dismissal completely vindicates him — it shows that nobody thought that he did anything wrong, nobody objectively did anything wrong, and it reaffirms what everybody has always thought, I think, which is that the Garden was wrong in the way that they treated him,” he said.

Spiro also alluded to the possibility that the hostility between Oakley and Dolan wasn’t over.

“[Oakley] will be pursuing all civil remedies against Mr. Dolan based on this incident,” Spiro said, without elaborating.

Following the February incident, Oakley was temporarily banned from Madison Square Garden.

Reporters on Friday asked if the new, year-long ban Oakley agreed to abide by bothered him.

“You’re OK with the one-year trespass?” one reporter asked him.

“Hey, it’s life,” he replied.

“You weren’t planning on going to the Garden anyway, right?” another reporter inquired.

“Next question,” Oakley said.