MIAMI — Florida's Stand Your Ground law was meant to make sure that average residents could defend themselves without fear of arrest or trial.

Now, police officers accused of using excessive force are trying to claim the law's protection.

They have sought to use the law to avoid trial in cases in which a 63-year-old man was stomped, a man in a wheelchair was beaten, and two men were shot dead in separate incidents.

In some instances, judges have granted their request.

"The law says it applies to 'any person,'" said Eric Schwartzreich, a lawyer representing a Broward County sheriff's deputy who made a successful Stand Your Ground claim in the 2013 killing of a computer engineer. "Law enforcement is any person. Why would there be a law that applies to one person in the criminal justice system and not another?"

The law has a contentious history and was opposed by prosecutors as soon as it was passed in 2005. It eliminates a person's duty to retreat from a dangerous situation and frees them to use deadly force "if he or she reasonably believes it is necessary" to prevent harm or death. It shields people from both criminal trials and lawsuits.

Stand Your Ground became widely known in 2012, when police in Sanford, Florida, cited it as the reason they declined to arrest the killer of an unarmed black teenager, Trayvon Martin. Critics say the law makes it too easy to claim self-defense when violence could have been avoided, and that white people's fears are more likely to be deemed "reasonable" than black people's.

Read More: A look at what happened the night Trayvon Martin died

Nearly two dozen states around the nation have such laws, but experts believe Florida is the only place where police officers have used it.

Civil rights lawyers say letting police officers invoke the law stretches its intent, and creates another avenue for them to get away with unjustified shootings. The state senator who sponsored the law, Dennis K. Baxley, said he was surprised to see officers invoke it, and even a lawyer for one of the officers who claimed Stand Your Ground said the law should be changed.

Police are already authorized to use force when they perceive danger, and even in highly disputed cases they usually avoid facing charges.

Stand Your Ground gives them an additional chance to do so, if they can persuade a judge. "A police officer has full immunity under the law if he uses deadly force appropriately," said David I. Schoen, a lawyer for the family of one of the police shooting victims. "You can't also give him Stand Your Ground."

Last week, lawyers notified the court that Nouman K. Raja, a former Palm Beach Gardens police officer, intended to seek Stand Your Ground protection in the 2015 killing of Corey Jones, a 31-year-old musician and housing inspector. Jones was waiting on the side of the road in a broken-down car when Raja, in plain clothes and an unmarked vehicle, approached him in the middle of the night without identifying himself.

Jones had a new gun he bought because he frequently carried cash on his way home from gigs. The officer claimed Jones pointed it at him, but prosecutors say Raja fired at Jones six times even as he fled, hitting him three times.

The encounter was recorded by the roadside assistance service Jones had called for help.

Raja, a rookie in the department, was fired. His Stand Your Ground hearing has been scheduled for March, when prosecutors must present a mini-trial before the judge, who will decide whether to dismiss the charges.

The hearing gives defendants a chance to beat the charges before trial. Prosecutors have argued that officers already have immunity for lawful shootings under a different law that specifically addresses law enforcement.

In a court motion, the Florida attorney general's office said police officers should not be allowed to get protection from both laws. Victims' families have also objected.

"I think it's very sad that police officers are taking advantage of that law, especially when they are in the wrong," said Jones' father, Clinton Jones Sr. "I think it's a disgrace to the police department."

Benjamin L. Crump, the family's lawyer, said the case "risks a terrible precedent."

"To extend it to police officers on the street gives them a license to kill just by saying they felt fear ? no standards, no objective check and balance," Crump said.

Raja's lawyer, Richard Lubin, declined to comment while the case is pending.

Raja was not the first to try the defense. A judge granted the Stand Your Ground claim of Schwartzreich's client, Broward Sheriff's Deputy Peter Peraza, in the 2013 killing of Jermaine McBean. McBean, 33, was walking down the street, wearing earbuds and with an air rifle propped on his shoulders, when Peraza ordered him from behind to drop it.

The officer claimed that McBean pointed the air rifle at him, although witnesses disputed his account. After a hearing, a judge ruled in Peraza's favor and dismissed the case.

The 4th District Court of Appeal upheld the ruling, but because the decision was in direct conflict with another appeals court ruling, the case is headed to the Florida Supreme Court.

In 2012, the 2nd District Court of Appeal rejected an officer's use of the law to avoid trial for stomping on a 63-year-old man. Juan Caamano, a former police officer in Haines City, south of Orlando, instead went to trial and was acquitted.

Last summer, two Miami police officers successfully invoked Stand Your Ground immunity when they were sued for damages in the beating of a man in a wheelchair.

Even Caamano's lawyer said police officers should not be allowed to invoke Stand Your Ground.

Local judges often have ties to law enforcement or are reluctant to rule against police officers for political reasons, the lawyer, Lawrence H. Collins, said.

"What it does in the case of police officers is it puts a decision of whether an action was justified in the hands of a judge rather than a jury," he said. "The law needs to be changed. You don't want that decision in the hands of a judge."