MINNEAPOLIS (AP) — Police investigating a potential sexual abuse case in a Minneapolis suburb found themselves in a gunbattle against a well-armed resident in a darkened home while trying to protect seven children inside, a prosecutor said Tuesday in a report on the shootings that left two officers and a paramedic dead.

Dakota County Attorney Kathryn Keena made the revelation in a memo, based on an investigation by the state Bureau of Criminal Apprehension, in which she concluded that the Burnsville officers who went to the home of Shannon Gooden on Feb. 18 were justified in using deadly force after he opened fire. While Gooden was struck in the leg by one officer's bullet, he died by suicide a few hours later. Seven children ages 5 to 15 were inside.

Keena's memo provided the most detailed explanation authorities have released so far about the confrontation. She wrote that Gooden's girlfriend, Ashley Dyrdahl, called 911 around 1:50 a.m. and screamed, “Help me!” before Gooden disconnected the call. The county attorney also detailed the hours of negotiations that ended in the gunfire that mortally wounded Burnsville Police Officers Paul Elmstrand and Matthew Ruge and firefighter-paramedic Adam Finseth, and left Sgt. Adam Medlicott injured. Medlicott survived to speak at the memorial service for his three fallen comrades.

The county prosecutor concluded that actions by Medlicott and two other officers was warranted to protect their own lives, the lives of their fellow other officers and members of the public.

“Accordingly, all three were legally justified in using deadly force in this extremely harrowing incident,” Keena wrote.

Ruge took the lead in the negotiations around 2 a.m., the prosecutor wrote. Officers spotted that there were children upstairs with Gooden, so they decided to negotiate rather than rush up to arrest him. Gooden denied that he was armed but repeatedly told them that children were nearby and not to shoot because of the risk to them. Gooden expressed concern that he would be imprisoned and prevented from seeing them. He did not comply with repeated orders to come downstairs and surrender.

Gooden opened fire with multiple guns from the upstairs hallway shortly before 5:30 am., based on body camera video, Keena wrote. Debris from the building filled the air.

Medlicott was struck in the arm. He looked back and saw Elmstrand had been wounded in the head. Medlicott provided cover fire to protect other officers as they evacuated Elmstrand to an armored vehicle in the driveway. Ruge was struck in his armored vest.

Another officer could see Gooden’s legs at the top of the stairs and could hear him reloading. The officer fired several shots, one of which struck Gooden in the thigh. The officer heard him grunting in pain.

As the paramedic was attending to Elmstrand at the armored vehicle, Gooden opened fire again from an upstairs window at 5:31 a.m., striking both Ruge and Finseth, who by that time were outside by the armored vehicle. Gunfire from both sides continued for about 13 minutes as an ambulance took the four injured to a hospital, As Gooden leaned out a window firing at officers who were taking cover behind the armored vehicle, a police sniper fired one round at Gooden, who retreated inside and stopped shooting. At least 41 shots struck the vehicle.

Around 6:50 a.m. officers heard a single gunshot from inside. One of the children inside then called 911 to report that Gooden had killed himself. The children were told to get dressed, and they safely exited at 7 a.m.

Dyrdahl told one of the officers dispatched to the home, which she shared with Gooden and the children, about possible sexual abuse. She also told them that Gooden was heavily armed and had previously threatened to “take everybody out with him.”

Gooden was a convicted felon who wasn't allowed to have firearms. Dyrdahl was later charged in federal court with buying the high-powered firearms that Gooden used in the shootings despite knowing that he couldn't possess them.

More From KROC-AM