BANGOR, Maine — A federal judge placed a Caribou man on probation for illegally having a gun rather than send him to prison where his mental illness might not be properly treated.

U.S. District Judge John Woodcock sentenced Curtis Todd Zetterman, 48, to five years of probation for possession of a firearm after being involuntarily committed to a mental institution in 2006.

Zetterman pleaded guilty in May 2010 to the charge, which stemmed from an incident at his apartment on Oct. 20, 2008. A neighbor called police to report that Zetterman had pointed a gun at him.

The gun, which was missing a safety, was loaded and had two live rounds in the chamber, Woodcock said in imposing the sentence. The gun was recovered by police, according to court documents.

“This situation was extremely dangerous,” the judge said. “If the neighbor or police officer had acted differently; if the defendant had so much as sneezed, we may have had a terrible tragedy.”

On Monday, Zetterman again denied pointing the gun at his neighbor.

“I believe I would never harm anyone unless they tried to harm me,” he told Woodcock. “I had no intention to hurt anyone. I was just looking at the gun.”

Since his indictment two year ago by a federal grand jury and while he has been on bail, Zetterman has been appointed a guardian to help handle his affairs, the judge said. He also has maintained a drug therapy and counseling regimen that will continue under probation.

Woodcock warned Zetterman that if he ever possessed a gun again, he would go to federal prison.

“I’m saying this in the most emphatic terms possible,” the judge said to Zetterman. “You are not allowed to have a gun. If you do, nobody will prevent me from sending you to jail.”

Zetterman faced up to 10 years in prison and a fine of up to $250,000. Under the prevailing federal sentencing guidelines, he faced between 18 and 24 months in prison.

Assistant U.S. Attorney James McCarthy, who prosecuted the case, and Zetterman’s attorney, federal defender Virginia Villa, recommended the five-month probation sentence.

Zetterman has been hospitalized many time for schizophrenia since his early teens, the judge said.