MINNEAPOLIS (WCCO) – Officials in Dakota County say a Burnsville police officer was found justified in using deadly force when he shot a man last fall who was making suicidal threats and allegedly pointed a gun at officers.

Dakota County Attorney James Backstrom announced Wednesday that he found Sgt. Steven Stoler was legally justified when he fatally shot Jamie Lewis.

READ MORE: Minneapolis Residents Can Submit Proposals For City Redistricting With New Online Tool

According to Backstrom, Stoler was one of the officers who responded to a crisis call on Sept. 26, 2016, in which Lewis’ ex-girlfriend said that Lewis was making suicidal threats following a breakup, was extremely upset and had walked out of their apartment with a handgun to kill himself.

The girlfriend told police that Lewis had previously been convicted of a felony and wasn’t legally allowed to carry a gun. The woman reported that Lewis said he’d rather die than go back to prison.

The responding officers found Lewis outside a commercial building near Cliff Road East. Stoler and another Burnsville officer, Brett Levin, encountered Lewis lying in the grass, holding a gun.

READ MORE: Election Judges Test Voting Machines Before Election Day

The officers called for Lewis to drop his gun and put his hands in the air. Lewis refused, moving the gun up and down and sometimes pointing it at his head.

Stoler told invsetigators that he shot Lewis when he sat up and pointed his gun toward him. The sergeant fired until Lewis stopped moving. In total, seven rounds were fired, three of which hit Lewis, who died at the scene.

According to the county attorney, Stoler was justified in shooting Lewis because he was acting reasonably to protect himself from apparent death or great bodily harm and because he was acting to prevent the escape of a person who might commit a crime or cause someone else great harm.

MORE NEWS: MPD Officer Brian Cummings Charged In Collision That Killed Leneal Frazier

“Law enforcement officers are trained to protect and serve our communities each and every day,” Backstrom said, in a statement. “Unfortunately, there are times when officers are placed in a situation where they must use deadly force to protect themselves and the public.”