NAMPA -- A pair of rival gang members whose shootout in a Nampa Walmart parking lot ended with a 10-year-old girl struck with a bullet pleaded guilty this week.

Ezri Garcia, 21, pleaded guilty to aggravated battery with intent to inflict great bodily injury and felony riot, with a gang sentencing enhancement Wednesday morning. Mario Garza, 19, admitted to aggravated assault with a weapons enhancement and felony riot with the gang enhancement.

The shooting happened June 29, as families gathered at Walmart to watch the fireworks show from the God and Country Family Festival at the nearby Ford Idaho Center.

ONLY ON 7: 10-year-old girl healing after hit by stray bullet

Prosecutor Erica Kallin, said Facebook messages recovered by investigators showed that Garcia, a member of the Sureno gang, and Garza, a Norteno member, had gotten into a fight the week before.

The shooting happened after Garza and Garcia spotted each other in the Walmart parking lot and got into a fistfight. During the fight, Garza hit Garcia with a handgun, then both men opened fire at each other, Kallin said.

The 10-year-old girl was hit by a stray bullet from Garcia's gun as she twirled in the grass next to a nearby Chevron station, waiting for the fireworks to start.

RELATED: Child hit by stray bullet in Nampa Walmart parking lot

The child's mother told KTVB she initially mistook the sound of gunfire for bottle rockets. Then she saw her daughter drop to the ground.

The girl was rushed to a local hospital with a gunshot wound to the shoulder. Although she survived the shooting, surgeons have been unable to remove the bullet, for fear of causing permanent nerve damage.

The 10-year-old told KTVB in September the wound still hurts and she is unable to raise her arm above her head.

Garcia and Garza originally faced 50 felony charges between them, but were allowed to shed most of the charges as part of their plea deals.

MORE: Suspects in Nampa Walmart shooting to be tried separately

Under the plea agreements, Garcia will face a fixed prison term of between five and seven years, with an indeterminate term of up to 12 years.

Garza will also have to spend between five and seven years behind bars before becoming eligible for parole. His indeterminate prison term could be up to 11 years.

Kallin said she spoke to the girl's mother about the plea agreements.

"She obviously wants more, but would prefer her child not have to testify if this was to proceed to trial," she said of Garcia's case.

Garza's sentencing is set for Jan 30, while Garcia will be sentenced Feb. 21.