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 civil lawsuits.