The shootout happened after Pearl police officers went to an apartment Tuesday to arrest Carnell Gaines Jr. and serve a search warrant based on information the girl gave during a forensic exam, said Rankin County District Attorney Michael Guest.
Gaines and investigator Michael J. "Mike" Walter, 37, died in the shootout at Colony Park Apartments in Pearl, a city of about 25,000 people just east of Jackson.
Another officer was shot in the hand and leg and was listed in good condition Wednesday at a hospital. A third officer was injured in the forearm, but not from a bullet wound, police said.
During the examination the girl said Gaines assaulted her and described watching what authorities believe was pornography, Guest said.
The officers knocked on the door of the apartment, but nobody answered so they asked the complex manager to let them inside. Gaines was in the back bedroom and fled into the bathroom, where the shooting occurred, Guest said.
Gaines was still on supervised release from a previous charge and probably knew he would be sent back to prison on a violation and for additional charges, Guest said.
"In addition, I'm sure he was aware of what he had done to the young child so I believe he made a decision that he wasn't going to be taken alive," Guest said.
Gaines was indicted on a federal charge in 2004 of being a convicted felon in possession of a gun, Guest said. He was sentenced in 2005 to 2 1/2 years to be served at the same time as a burglary charge in state court in Hinds County. He was sent back to prison on a probation violation for a six-month sentence in March 2011.
Warren Strain, spokesman for the Mississippi Department of Public Safety, said in a statement Wednesday that Gaines' mother is a civilian employee for the Mississippi Highway Patrol but "does not have access to the case files associated with the investigation" into the shooting.
Funeral services for Walter were incomplete Wednesday.
Walter, a San Diego native, played pitcher in the minor leagues for the Houston Astros' organization from 1993 to 2000, and spent part of his last four seasons playing for teams based in Jackson. He joined the Pearl Police Department in February 2009 as a patrol officer and quickly climbed the ranks to become an investigator in October 2010.
He leaves behind a wife, Jeanne, and his 11-year-old daughter, Bailey.