SAN SALVADOR, El Salvador - A court in El Salvador has sentenced 373 convicted members of the notorious Mara Salvatrucha gang to prison terms of up to 74 years for crimes ranging from murder and arms trafficking to terrorist association in a mass trial historic for the sheer number of defendants, authorities said Friday.

The courts’ press office said the case also confirmed there had been secret negotiations between criminal groups and politicians over support for the 2014 elections, evidence of which was presented at trial in videos, photos and transcripts of intercepted telephone calls.

In his ruling, Judge Godofredo Salazar criticized prosecutors for failing to charge the politicians, from both the leftist Farabundo Marti National Liberation Front, or FMLN, and the conservative Republican Nationalist Alliance, or Arena.

Among those in the recordings were Norman Quijano, ex-president of the Legislative Assembly, and San Salvador Mayor Ernesto Muyshondt of Arena, as well as an FMLN former interior minister.

Quijano has denied the allegations and said he never met with gangsters to negotiate anything at all. Muyshondt acknowledged in an interview with local television that he met with gang members, but said it was to ask them to allow his party supporters to vote.

El Salvador has posted yearly homicide rates among the highest on the planet, though killings are down about half this year compared with 2015, when it had the most murders per capita in the world.

President Nayib Bukele took office June 1 and ordered his new National Police chief to crack down on gangs in the face of rising attacks on security forces.

“This gives positive signs” of co-operation between the Justice Ministry, police and prosecutors, security analyst Ricardo Sosa said of the sentences. “There has been a shift from what the previous government did and there has been a focus on recovering territory, the social fabric and providing tranquility to the population with a significant reduction in violence.”

Bukele’s “great challenge,“ Sosa added, will be “to work on something that has never been done: rehabilitation and reinsertion of prisoners in a country that has 28 penitentiaries with over 38,000 inmates and an overcrowding rate of about 140%.”

More than 65,000 adults and youths are estimated to belong to “maras,” or gangs, in El Salvador, mostly Mara Salvatrucha, or MS-13, and also the 18th Street organization. The gangs are involved in drug trafficking, extortion and organized crime, and are blamed for most of the country’s violence.

In 2015, El Salvador’s Supreme Court defined MS-13 and 18th Street as terrorist groups, allowing courts to give gang members tougher sentences.