President Donald Trump said that if the wall along the southern border with Mexico had been built, the migrant dad and daughter who drowned this week “would be saved.”

Speaking at a press conference in Osaka, Japan, where world leaders are gathered at the G20 summit, Trump took a moment to offer his take on the global shock in response to the photo of Salvadorian man Óscar Alberto Martínez Ramírez and his daughter, Valeria, who were found face down and clinging to each other in the Rio Grande river. The two were attempting to make it across the river after failing to gain asylum from U.S. authorities.

“The father and the beautiful daughter who drowned... if they thought it was hard to get in, they wouldn’t be coming up,” Trump said.

Trump then called for tougher border patrol policies, adding that illegal immigration is “very unfair.”

“You have millions of people on line for years to get into a country. 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,” he said.

Trump’s comments came hours after a U.S. judge’s ruling that blocks his administration from using $2.5 billion in funds intended to be used for anti-drug activities to instead build a wall along the border with Mexico. Trump said that he is planning to immediately appeal the ruling.

In February, the Trump administration declared a national emergency to use $6.7 billion in funds that Congress had allocated for other purposes to instead be used for constructing the wall. U.S. District Court Judge Haywood Gilliam in Oakland, California said in a pair of court decisions Friday that the Trump administration’s proposal to transfer the funds was unlawful.

“We think we’ll win the appeal,” Trump said during another press conference at the G20 summit. “There was no reason that that should’ve happened.”