A Texas judge granted a temporary restraining order this week to the opponents of a crowdfunded project to build part of President Trump’s border wall, siding with a butterfly conservancy that sued over its projected environmental impact.

The legal standoff involves a three-mile stretch along the Rio Grande in Hidalgo County, where a hard-line immigration group that is led by Stephen K. Bannon, Mr. Trump’s former chief White House strategist, wants to build an 18-foot-tall wall on private property.

The project is part of a broader effort by We Build the Wall, which claims it has raised $25 million in private donations, to construct a barrier along the southwestern border with Mexico.

But the National Butterfly Center, a nearby 100-acre nature preserve, sued the group on Tuesday in District Court, accusing it of embarking on the project without the proper permits and upsetting the delicate ecosystem.