FRESNO, Calif. — A lawsuit filed by Missouri and five other states asking the court to strike down a California law barring the sale of eggs in the state produced by hens in cramped living conditions has been thrown out by a federal judge, The Associated Press reports. The suit was dismissed Thursday by US District Judge Kimberly Mueller, giving California a victory in a cross-country battle that pitted animal protections against the economic interests of farmers in the South and Midwest.

AP relays that Mueller said the states lacked legal standing to sue because they failed to show that the California law does genuine harm to their citizenry instead of just possible future damage to some egg producers.

"It is patently clear plaintiffs are bringing this action on behalf of a subset of each state's egg farmers," Mueller wrote in the decision, "not on behalf of each state's population generally." She further ruled that the suit can't be refiled or amended, though the states can appeal.

In February, Missouri Attorney General Chris Koster filed the lawsuit challenging the law that is set to take effect in January, 2015. Nebraska, Alabama, Oklahoma, Kentucky and Iowa joined the suit in March. These states contended the California law violates the interstate commerce clause of the US Constitution by effectively imposing new requirements on out-of-state farmers.

The six states combine to produce 20 billion eggs a year, of which nearly 2 billion are sold in California. Koster contended Missouri farmers would have to spend about $120 million to remodel their cages to comply with California's law or lose out on sales to a crucial market.

In a statement released when the lawsuit was filed, Koster said the case is "not just about farming practices" but about "whether elected officials in one state may regulate the practices of another state's citizens, who cannot vote them out of office."

The Humane Society of America, which helped defend the law in court, lauded the move.

"We are delighted that Judge Mueller has dismissed this baseless lawsuit, and ordered that it can never be filed again," said Jonathan Lovvorn, the organization's chief counsel for animal protection litigation. "The judge's opinion not only found that Attorney General Koster and the other attorneys general do not even have standing to file their case, but that their entire theory for why California's food safety and hen protection law will harm egg farmers is totally without merit."

A 2008 ballot measure was approved by California voters requiring pigs, calves and egg-laying hens to be raised with enough space to allow them to lie down, stand up, turn around and fully extend their limbs. California legislators later expanded the law to ban the sale of eggs in the state from any hens that were not raised in compliance with its animal-care standards.