Former Montgomery, Ala. police officer Aaron Cody Smith was convicted of manslaughter Friday for fatally shooting Gregory Gunn, an unarmed black man, in 2016.

Smith was charged with murder, but the jury was given the option to consider a lesser charge of manslaughter.

District Attorney Daryl Bailey said he would ask for Smith to receive the maximum sentence of 20 years in prison, according to WBRC.

A jury heard testimony for three days and then deliberated for three hours before coming to the verdict. Smith resigned from the department after the verdict was read. He'd been on paid leave since the killing.

Smith shot Gunn, 58, as he was walking home late at night. The officer had called Gunn over for a stop-and-frisk, at which point he fled.

Defense lawyers said that Smith fired the gun in self-defense because Gunn was grabbing a painter’s pole from a porch.  Prosecutors maintained that Gunn was never a threat to the officer.

Aaron Cody Smith

Aaron Cody Smith

The shooting sparked protests across Alabama’s capital city and “Justice for Gregg Gunn” signs dotted yards in the neighborhood where he was killed. Friends said Gunn was walking home from a weekly card game to the house he shared with his mother when Smith stopped him. He died yards from his home.

Prosecutor Ben McGough described Smith as a “bully with a badge” who repeatedly changed his account of the incident that led to Gunn’s death.

He also suggested the crime scene contradicted Smith’s account that Gunn attacked him with a metal pole.

“The other thing that came out is that he shot this guy in the back first," Bailey explained.  "That was the first shot that he made.”

Bailey told jurors that crime scene photos showed Gunn dead on the ground with a baseball hat still clenched in one hand, the Montgomery Advertiser reported.

“How in the world do you think he’s picking up this paint roller and doing all this swinging and all this threatening, and still holding his baseball hat in his hand?” Bailey asked.

Smith claimed that he’d been told to “stop everything that moves” in his district, due to a rash of burglaries in the area. He said he stopped Gunn because he believed he matched the description of a suspect wanted for property crimes.

Smith added that while he was patting down Gunn, he felt a hard object he believed to be a weapon and Gunn, who had cocaine in his system, swatted away his hand. He said Gunn ran, ignoring Smith's command to stop. Smith then deployed a taser and police baton, to no avail. When the pair arrived a front porch and Smith claimed Gunn grabbed a paint pole and Smith fired his weapon.

CLICK HERE TO GET THE FOX NEWS APP

“I had to stop him,” Smith said. “If he’s brave enough to kill a uniformed police officer — if he takes me out he’s got access to all my weapons on my belt, a running police Tahoe down the street with an AR-15 (semi-automatic rifle) inside.”

The trial was moved from mostly black Montgomery to Ozark, Ala. 85 miles away at the request of the defense because of the publicity the case received in Montgomery.

Franklin Gunn, Gregory's brother, told reporters that "one bad apple in a bunch has been weeded out" following the verdict.

“They brought this case to a very conservative county expecting a different outcome, but I believe we have seen the best of Alabama today,” he said.

The Associated Press contributed to this report.