A Tucson-based environmental group says the U.S. Fish and Wildlife Service illegally altered its rules in ways that will harm the ability of two snake species to survive in Arizona and New Mexico.

The Center for Biological Diversity filed suit Tuesday in federal court, contending it was illegal of the agency to reduce the amount of critical habitat for the narrow-headed garter snake and the northern Mexico garter snake. It wants a judge to order the service to go back and fix the issue.

There was no immediate response from Fish and Wildlife.

The lawsuit says the two species were listed as threatened throughout their range in 2014.

At the same time, critical habitat was proposed: More than 421,000 acres for the northern Mexico garter snake and more than 210,000 for the narrow-headed garter snake. But neither one was finalized.

In the interim, the lawsuit says, the Trump administration revised the rules under which areas considered “unoccupied’’ could be considered critical habitat. It also says other changes were made to the criteria used to provide such a designation.

Fish and Wildlife excluded the designation of hundreds of thousands of acres with ephemeral streams despite noting in its own proposed rules that both snakes rely on them, the suit says.

As a result, Fish and Wildlife eventually approved protection for 20,326 acres for the northern Mexico garter snake and less than 24,000 for the other species.

This is important because a critical habitat designation provides some protection against other activities that might harm the ability of a species to survive, said Robin Silver, co-founder of the Center for Biological Diversity.

When it comes to ranching, for instance, “cow grazing destroys riparian areas,’’ Silver said. There also are other factors beyond grazing, including mining, agriculture, suburban sprawl and drought due to climate change.

Acritical habitat designation would require proof that people who want to use the land will not endanger the species for whom the habitat was set aside.

Reducing the habitat area eliminates those protections, Silver said.

“Fish and Wildlife officials are once again choosing to protect interests of ranchers, developers and the Arizona Game and Fish Department at the expense of endangered species,’’ he said.

Silver said Arizona Game and Fish has introduced nonnative bullfrogs and fish, which pose their own threats to the snakes.