Top lobbying groups backed by Amazon, Facebook, Google and other technology giants sued Maryland on Thursday, seeking to scuttle a new state tax on their massive online-advertising revenue — and stop other local governments from following its lead.

The legal challenge contends that Maryland’s first-in-the-nation tax is unfair, unconstitutional and incompatible with federal laws that prohibit state policymakers from instituting levies specifically targeting online services.

The lawsuit is backed by a broad coalition of businesses nationwide through a series of trade groups, including the U.S. Chamber of Commerce and the Internet Association, a Washington-based organization that counts Silicon Valley’s most prominent companies among its members. It carries great legal and political significance at a time when lawmakers well beyond Maryland’s borders are starting to eye the tech industry’s eye-popping pandemic profits as a potential source of much-needed new revenue.

“In light of the current pandemic and economic uncertainty, increasing taxes on services used by small businesses to keep themselves running is a particularly poor and ill-timed policy,” Caroline Harris, the vice president for tax policy at the U.S. Chamber, said in a statement.

In the complaint, which was filed in U.S. District Court in Maryland, the tech giants and their political allies argue that the state’s online advertising tax suffers from “many infirmities” and, as a result, threatens to “raise costs for consumers and make it more difficult for businesses to connect with potential customers.”

Stephen P. Kranz, a partner at McDermott Will & Emery, who is representing the lobbying groups, said the lawsuit against Maryland also doubles as a legal warning shot to other governments. “We hope that policymakers in those states recognize that following Maryland only leads to the courthouse,” he said.

Under tight fiscal constraints, Maryland lawmakers adopted their tax last week to raise about $250 million annually for local education reform initiatives. Their vote — overriding an earlier veto from Gov. Larry Hogan (R) — came as roughly a dozen states, including New York, Indiana, Montana and Washington, are considering ways to tax tech giants over the advertisements they sell, the data they collect or the services they offer.

The Maryland law targets technology companies that do more than $100 million in ad sales each year. Those companies, led by Amazon, Facebook and Google, have been among its foremost opponents, joining a wide array of local and national business groups as part of a coalition called Marylanders for Tax Fairness that has run advertisements and lobbied lawmakers in an attempt to thwart the new policy.

(Media outlets including The Washington Post also had backed the coalition’s lobbying against the tax. Amazon CEO Jeff Bezos owns The Post.)

The tech giants and their corporate allies argue that Maryland’s new policy would hurt local companies most, forcing them to pay higher prices to advertise their offerings at a time when they may be least able to afford the expense. The claims appeared to serve as a tacit admission that Amazon, Facebook and Google each intend to raise their ad rates to defray the cost of new taxes. But the trio of tech giants — which collectively amassed more than $210 billion in revenue over the final quarter of 2020 — declined to say in recent days exactly how they would implement Maryland’s policy even as they laid the groundwork for a lawsuit to overturn it.

Their formal legal salvo arrived Thursday. The U.S. Chamber, the Internet Association and two other tech-focused trade groups, NetChoice and the Computer and Communications Industry Association, argued that Maryland’s tax is unfair because it targets only online advertising, not the same ads that appear in print or on television. They pointed to a 2006 federal law that is supposed to prohibit what the industry sees as discriminatory local taxes against online sites and services.

“It’s unfortunate that the Maryland General Assembly has decided to penalize a handful of out-of-state companies with this discriminatory law,” said Jon Berroya, the general counsel at the Internet Association, whose members also include Doordash, Expedia, Postmates, Spotify and Uber.

The representatives for these and other tech companies also faulted the way the tax is calculated. And they took issue with the law’s “punitive” origins, after Maryland lawmakers initially said they hoped to levy it in an attempt to crack down on Internet companies that collect vast amounts of data to calibrate their lucrative, targeted online ads. Lawmakers heard testimony last year from advocates who viewed the tax as a potential substitute for privacy regulation, but business groups said Thursday that the approach resulted in a policy “akin to a fine for perceived misconduct.”

The lawsuit drew a sharp rebuke from Senate President Bill Ferguson (D-Baltimore City), who authored the tax law. He faulted the companies for opting to “spend millions on high powered attorneys instead of paying their fair share.”

“For two decades, these companies have grown exponentially by availing themselves of the privileges of states, benefited from the aggressive uncompensated collection of personal and private information about Maryland’s residents, and been free riders to Maryland’s investments in our civic infrastructure,” he said in a statement. “All of this while contributing nothing to the future of Maryland’s residents.”

The architects of Maryland’s tax law had anticipated a lawsuit in the days before lawmakers voted Friday to authorize it. State Attorney General Brian E. Frosh (D) even warned the General Assembly last year that the tax could be struck down if it were approved. Frosh declined comment for this story.