A Florida woman sentenced to 20 years in prison after she fired a warning shot during a dispute with her husband has been granted a retrial.

Marissa Alexander, 32, said she fired into the ceiling because she was afraid of her husband. She invoked Florida's controversial stand-your-ground law but was found guilty of aggravated assault. The judge at her trial said that conviction carried a mandatory 20-year sentence under state law.

On Thursday an appeals court ruled that Alexander would get a new trial, however. Judge James H Daniel said that the burden had been improperly placed on Alexander to prove that the firing was in self defense.

"The defendant's burden is only to raise a reasonable doubt concerning self-defense," Daniel said, according to MSNBC.

"The defendant does not have the burden to prove the victim guilty of the aggression defended against beyond a reasonable doubt."

A separate hearing will decide whether Alexander can be released on bail pending the retrial.

Despite ordering a retrial, Daniel said that the judge in Alexander's first hearing was right to block her from using the stand-your-ground law to defend her actions. "We reject her contention that the trial court erred in declining to grant her immunity from prosecution under Florida's Stand Your Ground law," Daniel said. "But we remand for a new trial because the jury instructions on self-defense were erroneous."

It took just 12 minutes for the jury to find Alexander guilty in May 2012. She was sentenced to 20-years imprisonment under Florida's "10-20-Life" law, MSNBC reported, which carries a series of mandatory minimum sentences related to gun crimes.

Alexander argued that she had acted in self-defense after her husband Rico Gray attacked her at their home on 1 August 2010. Gray grabbed her by the neck, Alexander said, after finding texts from her ex-husband on her phone. She said she ran to the garage, returned with a gun and fired the gun into the air as a warning shot.

The case provoked outcry at the apparent double standard between Alexander's case and that of George Zimmerman, who killed Trayvon Martin and initially avoided arrest after invoking Florida's stand-your-ground law.

During her trial, lawmakers in Florida argued that the controversial law was entirely applicable in Alexander's situation.

"The stand-your-ground law was legislated and implemented to protect people like Ms Alexander," said state senator Gary Siplin. "She did not have a history of criminal or violent behavior; instead, she had a history of being physically and emotionally abused."