A judge on Wednesday dismissed a manslaughter charge against a Florida deputy who claimed self-defense in the 2014 fatal shooting of a 33-year-old black man carrying what turned out to be an air rifle.

Circuit Judge Michael Usan ruled in favor of suspended Deputy Peter Peraza of the Broward Sheriff's Office, who sought dismissal of the case under Florida's "Stand Your Ground" self-defense law that eliminates a requirement to retreat when facing a dire threat.

The manslaughter charge carries a potential 30-year prison sentence. Usan's decision can be appealed.

Peraza, 37, a white Hispanic, testified during a hearing that Jermaine McBean initially refused commands from him and other deputies to drop the authentic-looking weapon and then turned and pointed it toward the deputies in July 2014. Peraza fired three shots, killing him.

"I've never been so scared in my life," Peraza testified.

In his 36-page order, the judge called the shooting a "tragedy" and noted the ongoing national debate involving the shootings by police officers of black people and the hostility and threats sometimes directed at police.

But Usan said that debate has "no place in this courtroom concerning this case."

"This case involves the tragic death of one man and the liberty of another. To allow the conflicting agenda of supporters of either side to invade this legal process would be a far greater injustice," he said.

McBean family attorney David Schoen said he will continue to pursue a federal civil rights lawsuit against the sheriff's office over the shooting.

"It is complete travesty and miscarriage of justice," Schoen said of the ruling.

Amid national debate over police tactics involving minorities, Peraza was the first Florida law enforcement officer in three decades charged with a crime for an on-duty shooting.

On June 1, fired Palm Beach Gardens officer Nouman Raja was charged with manslaughter and attempted first-degree murder for killing stranded motorist and musician Corey Jones, who was black, while he waited for a tow truck. Raja, of South Asian descent, has pleaded not guilty.

Witnesses during the Peraza hearing described how 911 callers were reporting a man carrying a rifle, possibly a shotgun, down a busy street in broad daylight. In previous hearings, McBean has been described as being bipolar and recently recovering from a serious mental episode. He had just purchased the air rifle at a nearby pawn shop.

Peraza testified that McBean initially carrying the camouflage-designed rifle like a cane, and then put it across his shoulders behind his neck in a common military style as he approached his apartment complex, where families with children crowded a pool area. Suddenly, he said, McBean turned and pointed the gun at the officers.

"Completely defenseless, you have all these women and children in the pool area trying to enjoy their day," Peraza testified. "I don't know if my heart can race any faster and my fear level can go any higher."

Peraza also testified he did not see earbuds in 33-year-old McBean's ears before the shooting. McBean's family says he likely did not hear police commands to drop the rifle because he was listening to music.