California now has the strongest net neutrality rules in the nation, after Gov. Jerry Brown signed the bill during a last-minute flurry of bill signings and vetoes Sunday. A little over an hour after the announcement, the Department of Justice sued the state.

SB 822 is meant to fill the void left by the Federal Communications Commission’s repeal of the Obama-era federal regulations that prohibited internet service providers from engaging in blocking, throttling or discriminating against online traffic.

California’s bill, written by State Sen. Scott Wiener, D-San Francisco, had been hard-fought by ISPs, which argued along the way that it would be hard for them to have to comply with state-by-state regulations. The bill had a rough road in the state Legislature, where at one point it was watered down by one committee before consumer protections were restored to the version that eventually passed.

“This is a historic day for California,” Wiener said in a statement Sunday. “Today marks a true win for the internet and for an open society. I’m proud of the broad and diverse grassroots coalition that moved this legislation forward and got it passed.”

That coalition included advocacy groups such as San Francisco-based Credo.

“Thanks to hundreds of thousands of activists who would not give up the fight against all odds, Californians will have real, meaningful net neutrality protections,” said Brandy Doyle, Credo campaign manager, in a statement Sunday. “We thank Gov. Brown for standing with us and protecting the future of the internet and all our communities who depend on it.”

The high-fives were still going when the federal government crashed the party.

“Once again the California legislature has enacted an extreme and illegal state law attempting to frustrate federal policy,” U.S. Attorney General Jeff Sessions said in a statement announcing the lawsuit, filed in U.S. District Court in the Eastern District of California, Sunday. “The Justice Department should not have to spend valuable time and resources to file this suit today, but we have a duty to defend the prerogatives of the federal government and protect our Constitutional order.”

In March, Sessions sued California over its “sanctuary” laws on immigration, but the state’s laws were upheld in July.

“California fought Trump and Sessions on their immigration lawsuit — California won — and California will fight this lawsuit as well,” Wiener said Sunday night. “I have complete confidence that Attorney General Xavier Becerra will do a great job defending this law.”

The federal rules on net neutrality, the principle that all internet traffic should be treated equally, were enacted after years of legal and political wrangling. The issue has long had bipartisan support, and a Mozilla/Ipsos poll in April showed nearly 80 percent of Americans from both major political parties support it.

But AT&T, Comcast and other internet service providers argued in California, as they have for years, that net neutrality rules hinder innovation and investment in next-generation internet infrastructure.

In addition, ISPs claimed that the California bill goes further than the federal rules did, because it also bans some instances of zero rating, or the practice of exempting some online content from data caps.

“This bill is neither the way to get there, nor will it help advance the promise and potential of California’s innovation DNA,” said Jonathan Spalter, president and CEO of USTelecom, an industry group that counts AT&T and Verizon among its members, in a statement. “Rather than 50 states stepping in with their own conflicting open internet solutions, we need Congress to step up with a national framework for the whole internet ecosystem and resolve this issue once and for all.”

The federal Open Internet Rules, which were passed in 2015, were repealed by a Republican-majority Federal Communications Commission in December. The repeal, drafted by Ajit Pai — the FCC chairman appointed by President Donald Trump — took effect this year. Since then, states such as California have been scrambling to enact their own rules.

Three states, Oregon, Vermont and Washington, have enacted their own net neutrality rules, while governors in several other states have signed executive orders to establish some protections. Many other states are considering their own rules.

“California’s net neutrality bill is now the model for all future state and federal legislation,” said Gigi Sohn, who was counselor to former FCC Chairman Tom Wheeler.

Pai weighed in through a statement with the DOJ’s announcement of its lawsuit on Sunday: “I’m pleased the Department of Justice has filed this suit,” he said. “The Internet is inherently an interstate information service.  As such, only the federal government can set policy in this area.”

The DOJ lawsuit names Brown and Becerra as the defendants. The governor’s office said Sunday night it had no comment on the lawsuit.