San Francisco (CNN Business) A federal appeals court has largely upheld the Federal Communications Commission's controversial repeal of its net neutrality rules for internet providers, finding the agency didn't overreach when it decided in 2018 to deregulate companies such as Comcast ( CCZ ) and Verizon ( VZ ).

The decision marks a victory for the Republican-led commission in light of opposition by consumer groups, tech companies and local government officials who had sued the agency in a years-long battle over the future of the open internet.

But there is an important caveat: The court struck down a key aspect of the agency's order that could lead to further battles at the state level.

Tuesday's opinion by the US Court of Appeals for the DC Circuit is a win for the broadband industry, which had argued the regulations created uncertainty for internet providers and were too restrictive. But the decision also handed a partial victory to net neutrality advocates in that it provides a path for states to create their own net neutrality rules.

Both sides were quick to declare victory.

In a statement Tuesday, FCC Chairman Ajit Pai said the decision is a win "for consumers, broadband deployment, and the free and open Internet." He added: "A free and open Internet is what we have today and what we'll continue to have moving forward."

Democratic FCC commissioner Jessica Rosenworcel, a net neutrality advocate, cheered the court's decision as it "vacates the FCC's unlawful effort to block states and localities from protecting an open internet for their citizens."

For years, consumer groups have pushed for tough net neutrality rules . Advocates say providers should not be allowed to slow down websites, block access to apps or give faster service to preferred partners, which could distort the market for online services. Under those principles, Verizon, for example, would not be allowed to speed up loading times for, say, Yahoo, which it owns. Similarly, Spectrum could not downgrade Netflix as a way to deter cord-cutting.

In light of the decision, Mozilla, maker of the Firefox browser and one of the lead plaintiffs in the case, said the fight to preserve the principle of net neutrality "is far from over."

Consumer groups succeeded in 2015 when the FCC decided to regulate internet providers much like legacy telephone companies. The agency imposed clear rules banning the blocking, throttling or accelerating of Web content by internet providers and reserved the right to investigate business practices that risked violating the spirit of net neutrality.

Opponents charged that the rules were a gross overreach by the government. Industry groups argued the constant danger of FCC investigations created business uncertainty and the rules opened the door to direct federal regulation of broadband prices.

When President Trump took the White House, Republicans gained control of the FCC. Among the first acts Pai took as the new chairman was a plan to unwind the rules. Pai argued that the net neutrality regulations were heavy-handed and discouraged internet providers from upgrading their networks. In 2017, the FCC voted to repeal major parts of the rules, including the bans on blocking and slowing of websites.

Internet providers say they are not interested in blocking or slowing down websites anyway.

USTelecom, an association representing broadband providers, said the litigation showed how "Congress must end this regulatory rinse and repeat cycle by passing a strong national framework that applies to all companies."

But internet providers have lobbied for the freedom to strike deals with websites to provide premium service, possibly in exchange for extra fees.

Some policymakers have argued that practice, known as "paid prioritization," could benefit advanced applications like self-driving cars and telemedicine. Critics worry it could become an unbearable cost for some websites and tech companies — giving wealthy, established firms the power to dominate while marginalizing smaller businesses that can't afford to pay.

Those arguments figured prominently in the legal battle over net neutrality. A coalition of critics led by Mozilla sued the FCC in hopes of blocking Pai's deregulation.

The case was decided with the panel's three judges concluding the FCC acted lawfully when it decided to undo the Obama-era rules and regulate internet providers more lightly.

But the opinion also struck down efforts by the FCC to prevent state governments from enacting their own net neutrality laws and regulations. The court on Tuesday rejected that approach, saying it amounted to an attempt to "categorically abolish all fifty States' ... authority to regulate intrastate communications." The FCC could still seek to preempt states on a case-by-case basis, setting the stage for multiple legal tussles.

Andrew Schwartzman, senior counselor for the Benton Institute for Broadband and Society, said the decision "provides a roadmap to rules that can protect the promise of a vibrant internet that serves people, not the big cable and telcom companies."