A Brooklyn Park man who traded gunfire with another man in November 2016 over a stolen iPhone pleaded guilty Tuesday to second-degree assault and second-degree riot.

Tyler Schlotfeldt-Gidney, 22, faces a mandatory minimum three years in prison after admitting that he and another man were involved in a late-afternoon shootout in a north Minneapolis Taco Bell parking lot that left 25 shell casings at the scene. No one was hit in the shooting.

The other man, 26-year-old James Barnes of Minneapolis, faces two counts of a felon in possession of a firearm and has a trial scheduled on Feb. 12.

After the shootout, Barnes told police that he stole an iPhone from Schlotfeldt-Gidney’s brother a few days before and then drove to the Taco Bell with a gun inside his sweatpants to “deal with the situation,” according to the criminal complaint.

Barnes confronted Schlotfeldt-Gidney sitting in the passenger’s seat of a car, who told police that Barnes showed him his gun.

“That’s when I got to firing,” he said according to the criminal complaint.

Barnes was standing about 10 feet away but the shots somehow missed. He fired back as he ran for cover and kept shooting until he ran out of bullets, he told police. He hit Schlotfeldt-Gidney’s car, but neither he nor the person who was driving were hit.

Barnes told police he ran to a group of people hoping that Schlotfeldt-Gidney wouldn’t shoot at them, but they told him to get away. He ran to the Taco Bell when he heard two more shots fired. He asked someone he knew for a ride, but when that person refused, he ran to the nearby Wendy’s.

Surveillance video showed Schlotfeldt-Gidney firing three shots at Barnes as he ran away. The car carrying Schlotfeldt-Gidney then turned into traffic and sped off.

Though no suspects were immediately identified at the time, Schlotfeldt-Gidney called police later that day to say he was involved in the shootout. Two days later, Barnes called police asking why the car he left at the Taco Bell parking lot had been towed, according to the charges.