A Baltimore County, Md., judge this week overturned a jury’s decision that granted more than $38 million to the family of a woman who was fatally shot by the police after an hourslong standoff that had been partly streamed live on Instagram.

The woman, Korryn Gaines, 23, was shot several times by a Baltimore County police officer in August 2016 as she sat in her apartment with her 5-year-old son, Kodi Gaines, nearby. Her son was struck in the face by the officer’s gunfire.

Almost exactly a year ago, a jury found that the first shot the officer had fired at Ms. Gaines was not reasonable and awarded damages on the grounds that the police had violated the Gaineses’ civil rights and had committed battery on the mother and son.

But the decision on Thursday by the judge, Mickey J. Norman of Baltimore County Circuit Court, determined that the police officer who shot Ms. Gaines, Royce Ruby, was entitled to qualified immunity, a legal protection used to defend government officials from civil liability while they are acting in an official capacity. Critics of the doctrine have argued that it has denied justice to victims of abuse, especially when it is used in police shooting cases.