Donald Trump has blamed Democrats for immigrant children being separated from their parents at the US border with Mexico, saying it is “the fault of bad legislation” passed by the party.

His comments come after the United Nations called on the US to stop detaining and dividing migrant families. A spokesman for the UN said the US was “criminalizing what should be an administrative offense,” adding that most immigrants come from Central American countries ravaged by violence and should be afforded protections mandated under international law.

Trump took to Twitter on Tuesday to hit back at growing criticism of his policies, and called on Democrats to “get their act together” to change border security laws.

Separating families at the Border is the fault of bad legislation passed by the Democrats. Border Security laws should be changed but the Dems can’t get their act together! Started the Wall.

Republicans control all three branches of government in the US. The child separation policy was announced by Trump’s Attorney General Jeff Sessions at a law enforcement event in Scottsdale, Arizona, last month. “If you’re smuggling a child, then we will prosecute you and that child will be separated from you as required by law,” Sessions said. “If you don’t like that, then don’t smuggle children over our border.”

In an interview with NPR, also last month, White House Chief of Staff John Kelly tried to brush off concerns over the child-separation policy by saying that children taken from their families would be “taken into foster care or whatever.”

The law, adopted in 1986, permits the prosecution of adults separately from children when families seek asylum on the US border. Separated children are placed in the custody of the Office of Refugee Resettlement, a branch of the Health and Human Services Department.

Concerns over the detention of immigrants are not just a Trump phenomenon. Last week, a photograph showing two immigrant children in a cage was shared widely on Twitter. Many commentators held up the image as a symbol of the current administration’s inhumanity until it emerged that the picture was taken under Trump’s predecessor Barack Obama.

In his tweet, Trump also claimed that work had begun on his promised wall on the southern border. In March, the president said his administration had secured more than $1.6 billion for the wall, which was to go towards providing 100 miles of new and replacement wall. Earlier this month, construction crews broke ground on the first 14-mile stretch of wall in San Diego at a cost of $147 million.

While draconian immigration practices were rife under Barack Obama, they were not explicit government policy. Many people took to Twitter on Tuesday to express their outrage at Trump’s attempt to shift the blame on to Democrats, with some citing the detention of migrants in a former Walmart store in Brownsville, Texas.

A big lie. Trump could end this today. His supporters should be insulted by his belief they will accept any lie he tells, but he’s auditioning for even bigger ones about the Mueller investigation. https://t.co/1RvvjPrbHk