Trinitarios gangbangers slaughtered innocent Bronx teen Lesandro “Junior” Guzman-Feliz because they thought he was a rival gang member — not because of his resemblance to someone in a sex tape as investigators previously believed, officials revealed Wednesday.

The news came as NYPD Chief of Detectives Dermot Shea also said the department used its controversial gang database to track down the 12 men indicted in the killing. Officials previously told The Post they did not use the database.

The alleged killers are members of the Trinitarios subset “Los Sures,” which is locked in a war with rival faction “Sunset,” Bronx DA Darcel Clark said at a press conference Wednesday.

“They allegedly drove to the territory of the Sunset group, came upon Junior and chased him into a bodega in the Belmont section, where he tried to hide,” she said.

Then they hacked him to bits with knives and a machete.

Officials stressed Wednesday that Guzman-Feliz had no gang affiliation and was an innocent bystander.

Investigators previously believed he was mistaken for a teen in a sex tape that allegedly depicted a gang leader’s female family member.

But that was a social-media red herring, Clark said.

“There was a lot of social media, and it took a lot of time to sort out a number of those things, but as far as we know at this time, there was no relation to any sex tape to this particular case,” she said.

Shea, meanwhile, admitted the gang database was instrumental in capturing the accused.

“To do it without that criminal group database would really be asking my detectives to fight crime with one eye closed and one hand tied behind their back,” he said.

Twelve men have been arrested in the case. They all face murder charges and life in prison without parole if convicted. All 12 have pleaded not guilty.