The National Rifle Association is suing Los Angeles over a new law requiring companies that want city contracts to disclose whether they have ties to the gun rights group. (Johnny Hanson/AP)

The National Rifle Association is suing the city of Los Angeles over a new ordinance the gun rights group says violates free speech rights and equal protection rights.

Under the law, which took effect April 1, prospective contractors must disclose under affidavit any contracts, sponsorships or other ties they or their affiliates have with the NRA. If a business does not fully cooperate, the city can terminate the contract.

The Los Angeles City Council approved the ordinance, 14-0, in February. The city has similar policies about companies involved in the construction of President Trump’s proposed border wall, or that invested in or profited from slavery, the Los Angeles Times reported.

“The ordinance has nothing to do with awarding contracts to the best candidates,” according to the NRA lawsuit filed Wednesday in federal court. “Instead, it is about discriminating against a lawful organization and its members and supporters because the City does not approve of their political speech."

The NRA, which has nearly 5 million members, is one of the most vocal and visible gun rights groups in the country.

Pressure on businesses to cut ties with the NRA surged last year after 17 people were killed in a mass shooting at Marjory Stoneman Douglas High School in Parkland, Fla. Consumers and companies alike rallied around the hashtag #BoycottNRA. Their argument: A business with any ties to the NRA is complicit with the status quo, even as the country grapples with one mass shooting after another.

Los Angeles, meanwhile, is grappling with its own torrent of gun violence. Los Angeles County accounted for nearly 32 percent of homicides in California — and nearly 4 percent of all the homicides nationally in 2012, according to the Los Angeles Times.

“I support this policy, I’m confident in it, and we’re not going to be bullied by the NRA,” said Mayor Eric Garcetti, who was also named as a defendant.

The NRA didn’t immediately respond to a request for comment.

The NRA sued New York Gov. Andrew M. Cuomo and the state’s Department of Financial Services in May for what it called a “blacklisting campaign” meant to persuade banks and insurers to stop doing businesses with the gun rights group. The lawsuit was filed after the Financial Services agency imposed a $7 million fine against an insurance broker that administered an NRA-branded insurance program dubbed “Carry Guard,” Reuters reported. It also levied a $1.3 million fine on another insurer for having “unlawfully provided liability insurance to gun owners for acts of intentional wrongdoing,” Reuters reported.

The city ordinance says the NRA “has sought to block sensible gun safety reform at every level of government across the nation.” It also claims that the group ignores the wishes of some of its members by lobbying for “easy access to firearms, no background checks, no limits on magazine capacity, no regulation of assault weapons, no mandatory training and no age restrictions.”

“The City’s residents deserve to know if the City’s public funds are spent on contractors that have contractual or sponsorship ties with the NRA,” the ordinance says. “Public funds provided to such contractors undermines the City’s efforts to legislate and promote gun safety.”

For its part, the NRA’s lawsuit claims that L.A. hopes to pressure NRA supporters to bow out. The new ordinance, according to the NRA’s suit, aims to “silence NRA’s voice, as well as the voices of all those who dare oppose the City’s broad gun-control agenda.”