A US federal judge who was attacked by Donald Trump during his presidential campaign because of his Mexican heritage could make the final decision over the proposed border wall.

District Court Judge Gonzalo Curiel, who was born in the US after his parents emigrated from Mexico, is expected to hear a case on 9 February on whether construction of the wall would break environmental laws.

Curiel could rule against the Trump's administrations' efforts to build barriers on unfenced sections of the wall.

If the judge rules in favour of Trump, the president would be granted waivers needed to build on certain sections of the border, reports The Hill.

Andrew Gordon, a former Department of Homeland Security lawyer, told US news service McClatchy that the long-running dispute was a "very significant case".

In 2016, Trump attacked Curiel over a case filed against Trump University over alleged illegal business practices.

Trump said he would not get a fair hearing from the Indiana-born judge because he was "Mexican". Trump then doubled down on his comments, saying Curiel had "an inherent conflict of interest" in the case because his Mexican heritage put him in opposition to the border wall.

"He is a member of a club or society, very strongly pro-Mexican, which is all fine," Trump told Face the Nation host John Dickerson. "But I say he's got bias. I want to build a wall. I'm going to build a wall. I'm doing very well with the Latinos, with the Hispanics, with the Mexicans, I'm doing very well with them, in my opinion."

The remarks were widely condemned by Republicans. Former House Speaker Newt Gingrich said the comments were "one of the worst mistakes Trump has made". He added: "If a liberal were to attack Justice Clarence Thomas on the grounds that he's black, we would all go crazy."

Paul Ryan described the remarks as a "textbook definition of a racist comment".

Donald Trump
President Trump said Judge Curiel might be biased against him because of his Mexican heritage REUTERS/Jonathan Ernst