Congress never actually rejected President Trump's request to fund his wall along the southern border, a Justice Department lawyer told an apparently skeptical judge in Oakland on Friday in the nation's first court hearing on the legality of Trump's attempt to re-steer billions of dollars for the project.

Justice Department attorney James Burnham sought to counter arguments by California, 19 other states, and environmental and immigrant advocates that Trump had intruded on congressional authority over government spending by declaring a state of emergency and moving to fund the wall by transferring nearly $7 billion from other programs, mostly in the Defense Department.

"They want to say that's something that was denied by Congress because it wasn't funded by Congress. That's not true," Burnham said.

Congress approved only $1.375 billion for limited barrier construction after Trump triggered a record 35-day partial government shutdown over the issue, Burnham conceded. That was well short of what the president sought.

But Burnham said lawmakers also approved the Defense Department budget in September 2018 without restricting the Pentagon's ability to shift funds to future military-related projects, including the wall.

"If it was not denied in the budget process, then it's available," Burnham argued.

Although the Defense Department hadn't foreseen the need for wall money when its budget was approved, he said, military funds have been used to build fences near the Mexican border for 30 years, and "everyone knew that this was on the table."

U.S. District Judge Haywood Gilliam seemed unconvinced.

"Everyone knew it was on the table but it was unforeseen?" he asked.

Gilliam did not issue a ruling at the end of the hearing, which lasted two hours and 40 minutes. But he said he would decide whether Trump had exceeded his legal authority, apparently rejecting the administration's argument that the states and other opponents could not show they would be harmed by the wall and thus lacked the right to sue.

Trump had promised during his presidential campaign that Mexico would pay for the wall. But he sought $5.7 billion in funding from Congress last year, and when lawmakers failed to include the funding in the current budget, the president vetoed an appropriations bill and shut down many government operations from Dec. 22 until Jan. 25.

He declared a national emergency over illegal immigration on Feb. 15 and said he would fund the wall with $8.1 billion that was already in the budget. Lawsuits by the states, advocates for the environment and immigrants, and the Democratic-controlled House seek injunctions to block the funding and prevent construction.

"Congress is the only entity that can appropriate funds," Richard Letter, a lawyer for the House, told Gilliam. "The president decided Congress is just a nuisance."

The House filed arguments in support of the other plaintiffs in Gilliam's court and will argue its own lawsuit in a Washington, D.C., federal court next week.

Lee Sherman, a lawyer in California Attorney General Xavier Becerra's office, said presidents act "at the lowest ebb of their power in acting in defiance of Congress' intent."

Dror Ladin, an American Civil Liberties Union lawyer representing the Sierra Club and the Southern Border Communities Coalition, an immigrant rights group, said Trump was also defying Congress by transferring funds from unrelated military programs.

Lawmakers never intended that Pentagon money could be tapped "to be used for anything," Ladin said.

But Burnham, the government's lawyer, said the Defense Department funds now slated for the wall are governed by a federal law allowing their use for "any construction with respect to a military installation," which he described as "really broad" authority to choose construction projects.

Gilliam questioned that interpretation, saying the law seems to direct the funds' use to military bases.

Burnham also argued that states and environmental groups should not be allowed to sue because they can't show any potential harm from an "internal accounting transfer" of government funds.

Ladin countered that for his clients, construction of a wall "would fracture communities, damage their environments and sacred sites, and completely disrupt lands they call home."

This article is written by Bob Egelko from San Francisco Chronicle and was legally licensed via the Tribune Content Agency through the NewsCred publisher network. Please direct all licensing questions to legal@newscred.com.