A federal judge in California ruled in favor of the Trump Administration on Thursday, blocking a bill that gave the state the right to thwart the sale of federal lands to private interests, including loggers, oil drillers and developers, reports said.

U.S. District Judge William Shubb ruled against the state’s Senate Bill 50, which gave the State Lands Commission the first right of refusal of the sale of federal lands in California, the Sacramento Bee reported. The bill was signed into law by Gov. Jerry Brown in October 2017, according to the Sacramento Bee. State Sen. Ben Allen, D-Santa Monica had sponsored the law, the San Francisco Chronicle reported.

The judge’s ruling said the bill is unconstitutional because it “trespasses on the federal government’s ability to convey land to whomever it wants,” the Bee reported.

The federal government owns 46 million acres of land in California, including Point Reyes National Seashore and Yosemite National Park, according to the Chronicle.

TRUMP ADMINISTRATION SUES CALIFORNIA OVER FEDERAL LAND SALES

State lawyers argued that government-owned lands are entitled to greater legal protection because they have been “preserved for the public benefit,” the report said. But Shubb said the lands are “linked to their federal status” and couldn’t be under state regulation, according to the paper.

The state’s Lt. Gov. Gavin Newsom, who is running for governor and is a member of the Lands Commission, pushed back on the Trump Administration’s lawsuit last April to halt enforcement of SB 50, according to the Bee.

“We will use every legal and administrative tool to thwart Trump’s plans to auction off California’s heritage to the highest bidder,” Newsom said. "Yet again, Donald Trump and his administration are attacking our state and our very way of life.”

California Attorney General Xavier Becerra also said in a statement in April that "we're prepared, as always, to do what it takes to protect our people, our resources and our values."

The State Lands Commission said it is analyzing the ruling, but had no further comment, the Bee reported.

Meanwhile, the Trump Administration lauded the court victory.

“The court’s ruling is a firm rejection of California’s assertion that, by legislation, it could dictate how and when the federal government sells federal land,” Attorney General Jeff Sessions said in a prepared statement, according to the Bee. “This (law) was a stunning assertion of constitutional power by California, and it was properly and promptly dismissed by the district judge.”

The lawsuit had cited the sale of Army property east of San Francisco, which the state declined to purchase. The State Lands Commission has requested information about a planned property sale in Santa Barbara County to decide whether to buy first, according to the lawsuit.

The auction of 1.7 acres owned by the U.S. Postal Service was suspended when nobody bid, and a developer looking to purchase property at the now-closed Naval Air Station Alameda has requested a delay, the lawsuit contended,

The deadline to appeal the ruling is Dec. 31.

Fox News’ Samuel Chamberlain contributed to this report.