For two hours, Sahar Nikpay held off police with his AK-47-style rifle, firing at them from his basement as they tried to serve a no-knock warrant at his Robbinsdale home.

One shot pierced a natural gas canister outside. Another hit the refrigerator next to a Hennepin County deputy. After Nikpay's peaceful surrender, deputies found 90 discharged casings in the basement, two empty high-capacity magazines and a substantial stash of full magazines and ammunition.

That was on April 8, 2010.

On Friday, a Hennepin County District Court jury delivered a rare verdict, finding Nikpay legally insane at the time of the shootings. The decision means he was acquitted of the most serious charges of assault and attempted murder for firing at the officers.

However, Nikpay was determined to be sane when he obtained the illegal guns, so he was convicted of being a felon in possession of firearms.

Insanity trials are rare. Most often, defense attorneys and prosecutors agree on a defendant's mental state.

When sanity is contested, the trial comes in two phases. First, the jury determines whether the defendant committed the crimes. In the second phase, the jury hears testimony, then determines whether the defendant was sane at the time he committed the crimes.

Nikpay's guilt wasn't the big issue here. He was found to have committed the crimes. In the second phase, the jury heard testimony from doctors, then spent nearly 16 hours determining whether Nikpay was sane. "So it wasn't easy, but it certainly was the right decision," defense lawyer Peter Wold said.

Wold, a top defense lawyer with 35 years of practice in Minnesota, said he had never tried an insanity case, let alone successfully.

The legal history of this case is complicated.

Initially, Nikpay was found not competent to stand trial. Then he was sent to mental health court, where he was found to be mentally ill and dangerous. Since then, he has been receiving treatment for a "psychotic disorder" at the Minnesota Security Hospital in St. Peter.

Delusional and untreated

Wold said the treatment was the first Nikpay had received in his life. The defendant became healthy enough to stand trial.

When he shot at the officers, Wold said, Nikpay was delusional. He had obtained an assault rifle and carried it around his house because he believed he was a chosen one who would be rescued unless assassins came for him. "So when 10 cops threw a flash bomb in his yard … he knew exactly what was happening," Wold said.

Nikpay was 25 when the incident occurred at his home in the 3300 block of Chowen Avenue N. He has been locked up ever since.

The average stay for a person committed as mentally ill and dangerous is 7.5 years. His time in treatment is counted toward his eventual sentence so he may not be required to go to prison.

At the time of the raid, Nikpay had previous convictions for aggravated robbery and burglary.

The Hennepin County attorney's office declined to comment on the verdict.