In a test case with border-wide implications, a federal appeals court on Thursday reversed the littering conviction of a man who left gallon jugs of water on a national wildlife refuge to help illegal immigrants cross the remote federal land safely.

In a 2-1 ruling, the Ninth U.S. Circuit Court of Appeals said since the water was meant for drinking the jugs weren’t clearly “garbage,” and the law prohibiting dumping on federal lands was “sufficiently ambiguous in this context that the rule of lenity should apply.”

The majority said the man, Dan Millis, could have been charged with some other crime such as abandonment of property, but that argument wasn’t made to the lower court.

The case stemmed from a 2008 incident in which Mr. Millis and several other activists from a group named No More Deaths carried 25 jugs of water into Buenos Aires National Wildlife Refuge, on the U.S.-Mexico border in Arizona, intending to leave them for illegal immigrants trying to cross the desolate landscape.

U.S. Fish and Wildlife Service employees spotted the activists and told them to pick up all the jugs. When not all of them were collected, the activists were charged with littering on federal lands.

Mr. Millis said he sees the ruling as a victory, and said he expects more severe intentional littering charges against another activist to be dropped eventually in light of this ruling. But he said the overall situation isn’t resolved.

“The federal government can find a million excuses to go after us if they want to, and they have in the past,” he said. “What needs to happen here is not a continuation of the struggle between the federal government and the volunteers, what needs to happen is a change in border policy and a change that is more respectful of human rights.”

In a dissenting opinion, Judge Jay S. Bybee said the water jugs clearly met the definition of litter, since the wildlife refuge didn’t authorize them to be left there.

“It wouldn’t matter if the items were really nice sleeping bags forgotten by the inattentive scouts of Troop 101. In the context of the wildlife refuge, plastic water bottles and sleeping bags are litter and inconsistent with conservation in the Buenos Aires National Wildlife Refuge.,” Judge Bybee wrote.

Another group, Human Borders, does have a permit to leave tanks of water in the refuge for illegal immigrants.

The U.S.-Mexico border includes vast, remote lands in Arizona, and hundreds of illegal immigrants die each year while trying to cross into the U.S. And the tougher it becomes to cross, the more illegal immigrants are pushed into dangerous areas.

Mr. Millis said even though illegal crossings overall are down, deaths are headed for a record this year.

But the public lands on the border are also facing a crisis, thanks to the war between illegal immigrant crossers and drug smugglers on the one hand, and the U.S. Border Patrol that is trying to catch them. Land managers say the battle often hurts the animals that refugees were set up to protect.

Some areas of Organ Pipe Cactus National Monument, which shares 32 miles of the border with Mexico, have been closed for the last several years due to the dangers surrounding illegal immigrants and drug smuggling.