Donald Trump has suggested that if his border wall had been built along the United States-Mexico border, the father and daughter found washed up on the bank of a river, migrants from El Salvador attempting to reach the US, would not have died.

Speaking in Osaka at the end of the two-day G20 summit, the US president was asked about the shocking image of Oscar Ramirez, 25, and Angie Valeria, almost two years old, seen face down in the Rio Grande.

“The father and the beautiful daughter who drowned ... if they thought it was hard to get in, they wouldn’t be coming up, they wouldn’t be coming up and so many lives would be saved,” Mr Trump told reporters at Saturday’s press conference.

Discussing the river in which they were found dead, the president added: “You know the Rio Grande is very tough ... it has moments where it can be very calm and then all of a sudden it becomes totally violent and then people get swept away.”

Mr Trump doubled down on his hardline immigration rhetoric, describing a federal court decision to block border wall funding a “disgrace” and migrant crossings from Mexico as “very unfair”.

“You have millions of people on line for years to get into a country,” he said. “They take tests, they study ... and these people have worked hard, they’ve been on line for seven, eight, nine years, then someone walks in. Honestly it’s very unfair.”

Days after she lost her daughter and husband to the treacherous currents of the Rio Grande, Tania Vanessa Avalos, 23, arrived back in El Salvador to await her family’s bodies to be returned in coffins.

A photo of the two drowned migrants in the reeds of the river’s shore sparked public outcry. A series of Democratic candidates in the 2020 presidential race have spoken out in response to the photo, with Beto O’Rourke saying that “Trump is responsible for these deaths”.

The Independent has made the decision to publish the image to illustrate the human cost of current US immigration policy and the desperate reality of migrants’ attempts to enter the country.

Donald Trump speaks during a news conference in Osaka, Japan (AP)

On Friday a federal judge blocked the Trump administration from tapping $2.5bn (£2bn) in defence department funding to build segments of the president’s prized border wall in California, Arizona and New Mexico.

Judge Haywood S Gilliam acted in two lawsuits filed by the state of California and by activists who contended that the money transfer was unlawful and that building the wall would pose environmental threats.

Responding to the news at the press conference in Osaka, Mr Trump called the decision “a disgrace”. He added: “So we’re immediately appealing it and we think we’ll win the appeal. There was no reason that that should have happened. And a lot of wall is being built.”

The fight over the border wall is far from over. The US Ninth Circuit Court of Appeals is expected to take up the same issue of using military money next week.

At issue is Mr Trump’s February declaration of a national emergency so that he could divert $6.7bn from military and other sources to begin construction of the wall, which could have begun as early as Monday.

The president identified $3.6bn from military construction funds, $2.5bn from Department of Defence counter-drug activities and $600m from the Department of the Treasury’s asset forfeiture fund. Friday’s federal court decision did not rule on funding from the military construction and treasury budgets.