SAN SALVADOR, El Salvador (AP) — El Salvador has made it illegal to belong to a street gang in the wake of an attack on a passenger bus that killed 17 people.

The new law, approved by lawmakers Thursday, makes gang membership punishable by four to six years in prison. Gang leaders face up to 10 years.

President Mauricio Funes introduced the measure in July, a month after suspected members of the Mara 18 gang opened fire on the bus and set it afire.

Gangsters arrested for specific crimes already fill El Salvador's jails, but it previously was not a crime simply to belong.

The new law was criticized by a non-governmental organization that works to rehabilitate former criminals.

"This law is a bit strange," said Luis Romero Gavidia of Homies United, which worlds with ex-gang members. "They are only talking about repression and have forgotten about rehabilitation. ... They are confronting sickness with another sickness."

An estimated 20,000 Salvadorans belong to street gangs that deal drugs and extort businesses.