The Smithtown man who was beaten and threatened by former Suffolk Police Chief of Department James Burke was freed Tuesday as a result of perjured testimony given by police officers at Burke’s direction.

State Supreme Court Justice Richard Ambro set aside Christopher Loeb’s guilty plea to criminal possession of a weapon, for which he was sentenced to 3 years in prison.

A nervous but relieved Loeb, 30, said later at his lawyer’s office that it’s appropriate that he is free while Burke remains in prison for violating Loeb’s civil rights and covering it up.

The beating of Loeb led to Burke getting sent to federal prison for 46 months and numerous sealed guilty pleas by other Suffolk police officials involved in the cover-up. It also spurred an investigation that has targeted officials in the office of Suffolk District Attorney Thomas Spota, Burke’s friend and mentor.

“For the first time in four years, I can actually enjoy my freedom knowing that James Burke is incarcerated and unable to harm me, my family or any other resident of Suffolk County,” Loeb said, thanking both federal prosecutors and his attorneys, Bruce Barket and Donna Aldea of Garden City. “It’s shameful that it took an outside agency to come into Suffolk County and unmask this county.”

Yet Loeb said he still couldn’t relax.

advertisement | advertise on newsday

“I don’t think I’m ever going to feel safe,” he said. “There are numerous people out there who did dirt with Burke.”

That’s why he said Burke’s imprisonment is more meaningful than his own freedom — something to which he’s still adjusting. “I’m still asking permission to go the bathroom,” he said.

Barket joked, “You have my permission.”

Loeb is not yet done with the legal system. Although Ambro and special prosecutor William Ferris agreed to vacate Loeb’s guilty plea, the original indictment, which includes stolen property and other charges, was reinstated. Loeb again pleaded not guilty.

But Barket, noting that Loeb has already served more than his entire sentence because of an additional probation violation, said it’s impossible for his client to serve more time in prison, and Ferris agreed.

In addition, Barket said no conviction is possible, with so many of the charges the result of lies by police.

“The indictment is literally built on a hill of perjury,” Barket said. “The evidence is only as good as the people who bring it to court.”

For now, all sides agree that Loeb’s guilty plea was unjust. He entered the plea after a pretrial hearing in which several officers and detectives testified under oath that they didn’t see Burke beat Loeb.

“A plea of guilty based on perjured testimony at his pretrial testimony cannot stand,” said Ferris, appointed because of Spota’s ties to Burke. Convictions should not be upheld when they are based on violations of the Constitution, he said.

Suffolk police did not respond to a request for comment.

advertisement | advertise on newsday

When Burke pleaded guilty last year in federal court to violating Loeb’s civil rights and covering it up, he said Loeb accurately described how Burke treated him. Loeb had broken into Burke’s police vehicle and stole a duffel bag that he said contained “disgusting pornography,” a gun belt without a gun and other items.

Burke took his property back before it could be kept as evidence and later beat Loeb and threatened to kill him.

Loeb, who has struggled with heroin addiction, spoke Tuesday of the “challenges” that lie ahead.

“I have the faith and hope necessary to become the productive, successful and happy person I want to be,” he said.