(Reuters) - The National Rifle Association sued Los Angeles on Wednesday over a new law requiring that contractors disclose their ties to the gun rights group as a condition of obtaining business from the second most-populous U.S. city.

An attendee speaks to representatives of the National Rifle Association (NRA) at the Conservative Political Action Conference (CPAC) annual meeting at National Harbor in Oxon Hill, Maryland, U.S., March 2, 2019. REUTERS/Joshua Roberts

Los Angeles was accused of trying to “silence NRA’s voice, as well as the voices of all those who dare oppose the city’s broad gun-control agenda,” by cutting off revenue streams the group needs to advocate for the right to bear arms.

At issue was an ordinance that took effect on April 1, requiring companies that want city contracts to disclose NRA contracts or sponsorships.

The NRA said the law is unconstitutional because it violates its First Amendment right to free speech and association, and its 14th Amendment right to equal protection. It sued in Los Angeles federal court.

Mayor Eric Garcetti, also named as a defendant, signed the contracting law on Feb. 18 following passage by the Los Angeles City Council.

That body said providing public funds to NRA-linked contractors undermines efforts to promote gun safety in Los Angeles, which has about 4 million people.

Spokesmen for Los Angeles City Attorney Mike Feuer said his office will vigorously defend the ordinance.

Garcetti said: “I support this policy, I’m confident in it, and we’re not going to be bullied by the NRA.”

The lawsuit was filed 11 months after the NRA sued New York Governor Andrew Cuomo, accusing him of threatening its survival by pushing insurers and state-chartered banks to stop doing business with gun rights groups.

New York has denied the NRA’s “blacklisting” accusations.

The Los Angeles ordinance was a response to what it said were more than 1,600 mass shootings in the United States since the December 2012 attack at the Sandy Hook Elementary School in Connecticut.

It cited shootings including the November 2018 killing of 12 people at a Thousand Oaks, California bar, the October 2018 deaths of 11 worshippers at a Pittsburgh synagogue, and the October 2017 killing of 58 people at a Las Vegas music concert.

According to the NRA, the Los Angeles law has nothing to do with awarding contracts to the best candidates.

“This is one of the largest cities in the country using its power to bully lawful businesses and individual members based on their political viewpoint,” the complaint said.

Chuck Michel, a lawyer for the NRA, in a statement accused Los Angeles of “modern day McCarthyism,” echoing language he used when the law was passed.

The case is National Rifle Association et al v. City of Los Angeles et al, U.S. District Court, Central District of California, No. 19-03212.