CNN  — 

A judge has overturned a more than $37 million verdict awarded to the family of a woman killed in an armed standoff with Baltimore County police.

Korryn Gaines, 23, was shot and killed in August 2016 after an hours-long standoff with police in Baltimore County. She was trying to livestream the encounter with police, authorities said at the time.

Her son, Kodi, then 5, also was shot twice, said Kenneth Ravenell, an attorney for the child and his father, Corey Cunningham.

In an opinion obtained by CNN, Baltimore County Circuit Court Associate Judge Mickey J. Norman said Cpl. Royce Ruby, who court documents say shot Gaines twice, was “entitled to qualified immunity.” This means that because Ruby was acting in his capacity as a police officer, he is “shielded from liability for civil damages” as long as his conduct didn’t violate a person’s constitutional rights.

“The evidence is clear,” Norman’s opinion read. “This Court has found that Corporal Ruby is entitled to qualified immunity and therefore, his shooting of Gaines was not unlawful.”

Norman said the court would grant a new civil trial as a result of this new opinion.

The opinion also states the non-economic damages awarded to Gaines’ family were “excessive and shocks the conscience.”

The jury awarded $32.85 million to Kodi Gaines and an additional $23,542 for his medical expenses, and $4.53 million to the woman’s daughter, Karsyn Courtney, according to Ravenell. It also awarded $307,000 to Korryn Gaines’ mother, Rhanda Dormeus; $300,000 to her father, Ryan Gaines; and $300,000 to Gaines’ estate.

J. Wyndal Gordon, Gaines’ family attorney, told CNN Friday night the family was disappointed with the court’s decision, but is neither “defeated nor deterred from doing what must be done now.”

“We have great appellate issues and an excellent opportunity to have reviewed not just the recent decision but some of the earlier decisions in the case that were disfavorable,” Gordon said. “Nobody told us the road would be easy. I don’t believe God brought us this far to leave us. This case is by no means over. We will fight to the finish to preserve the jury’s verdict and restore justice to the family.”

Cpl. Shawn Vinson, Baltimore County police spokesperson, told CNN on Friday that Ruby is still a member of the department and deferred further comment to the Baltimore County Office of Communications. CNN reached out to the county office of communications Friday but has not heard back.

Armed standoff

On August 1, 2016, three warrant service officers went to serve a man and a woman in the Randallstown area near Baltimore.

Upon arriving, the officers heard the voices of a man, a woman and a crying child inside the apartment.

They waited outside the door for about 10 minutes, Baltimore County Police Chief Jim Johnson said shortly after the shooting. Then, one officer obtained a key to the apartment.

The man, Kareem Courtney, was wanted on an assault warrant, while Gaines was wanted on a bench warrant over failure to appear in court to face traffic charges, police said.

Gaines had a Mossberg 12-gauge shotgun, which she pointed at police, Johnson said.

The officers called for a tactical team and waited.

Not long into the standoff, Courtney left the apartment with a 1-year-old child and was arrested.

That left Gaines and then 5-year-old Kodi in the home.

“Gaines was posting video of the operation as it unfolded,” Johnson said.

Gaines vacillated between agitated and calm during the encounter, he said. Several times she pointed the shotgun at officers.

According to court documents, Gaines would not let her son leave. She was quoted in the documents as saying, “I have a gun you have a gun the only difference between you and me is that I’m ready to die and you’re not.”

Ruby and the SWAT team were positioned in the hallway outside of Gaines’ apartment, according to the documents.

Before the first shots were fired, documents say Gaines moved from her living room to the kitchen, where she “was partially concealed behind an interior wall.”

“Corporal Ruby testified that he believe that when Gaines relocated behind the kitchen wall she had a tactical advantage putting her in a position to shoot at officers,” court documents say.

Ruby shot Gaines the first time, and her shotgun discharged, according to documents. Ruby testfied he then heard the “pump action of the shotgun ‘rack,’” and Gaines discharged her gun a second time.

“He perceived that she was about to shoot again and he shot her a second time,” court documents said.

Kodi was hit in the elbow and in the cheek during the crossfire. The cheek injury was superficial, documents said, but he had to have reconstructive surgery on his elbow.

At the time, authorities said Gaines was trying to livestream the incident on social media.

During the standoff, police requested that Facebook deactivate her account on the service and on Instagram, which Facebook owns, Johnson told reporters after the shooting.

CNN’s Connor Spielmaker contributed to this report.