(Reuters) - A federal judge has declared unconstitutional a California law that restricted the U.S. government’s ability to sell or transfer federal land in the state to private entities, handing a victory to the Trump administration.

In a decision on Thursday, U.S. District Judge William Shubb in Sacramento, said the law discriminated against land purchasers who deal with the United States.

He said the law violated the so-called doctrine of intergovernmental immunity and the Constitution’s Supremacy Clause, which governs conflicts between state and federal laws, and issued a permanent injunction against its enforcement.

The U.S. Department of Justice in April sued California over the law, known as Senate Bill 50, which gave the California State Lands Commission a right of first refusal over many land transfers.

Supporters hoped the law would stop the Trump administration from selling land that could later be used for oil drilling, mining or property development.

Governor Jerry Brown, a Democrat, signed the law in October 2017. It took effect on Jan. 1, 2018.

A spokeswoman for the State Lands Commission declined on Friday to comment on the decision, and said the agency has not decided whether to appeal.

U.S. Attorney General Jeff Sessions called the decision a “firm rejection” of California’s “stunning assertion of constitutional power” to dictate how and when the federal government can sell its own land.

He also said federal judges in recent months have voided two other California laws “designed to frustrate federal law,” and said that the trend was “concerning.”

California is one of many Democratic-controlled or Democratic-leaning states that have passed laws to counteract policies endorsed by President Donald Trump, a Republican, and his administration.

The federal government owns about 46 million acres in the state, or 46 percent of California’s total acreage, according to the Congressional Research Service, and Shubb’s decision could allow it to sell more federal land there.

Shubb said Senate Bill 50 illegally impeded the government’s ability to manage its land through such agencies as the National Park Service, National Forest Service, U.S. Fish and Wildlife Service and Bureau of Land Management.

He also said California did not show that its law was needed to protect “sensitive” and “unique” lands.

“Rather, SB 50 uncritically uses federal administrative and institutional categories to target the federal government and those with whom it deals for regulation,” Shubb wrote.

Shubb was appointed to the bench in 1990 by President George H.W. Bush, a Republican.

The case is U.S. v California et al, U.S. District Court, Eastern District of California, No. 18-00721.