Barack Obama has issued a plea for compassion towards refugees as thousands of migrant children have been separated from their parents at America’s southern border.

“To watch those families broken apart in real time puts to us a very simple question: are we a nation that accepts the cruelty of ripping children from their parents’ arms, or are we a nation that values families, and works to keep them together?” the former president wrote on Facebook.

A “zero tolerance” crackdown by the Trump administration has broken apart immigrant families as the parents are placed into criminal proceedings, spurring global outrage and a bipartisan calls in Congress to rescind the policy.

While Mr Obama did not directly reference the Trump administration, timing this post to World Refugee Day, his exhortation to treat immigrant families with kindness was a clear rebuke to his successor’s stringent stance.

“Imagine if you'd been born in a country where you grew up fearing for your life, and eventually the lives of your children. A place where you finally found yourself so desperate to flee persecution, violence, and suffering that you'd be willing to travel thousands of miles under cover of darkness, enduring dangerous conditions, propelled forward by that very human impulse to create for our kids a better life," Mr Obama wrote.

It was a marked contrast in tone from Donald Trump, who typically speaks of immigrants in terms of crime and earlier this week decried migrants who “infest” America.

Mr Obama has a mixed record on immigration, deporting a record number of people but also embracing a shift away from targeting people for deportation who had not committed crimes or had deep roots in America.

Nancy Pelosi says majority of America and Republicans support protecting DREAMers

His administration’s approach to refugees differed dramatically from Mr Trump’s. After the Syrian civil war displaced millions during Mr Obama’s final years in office, the president announced in late 2016 that he would seek to take in 110,000 refugees.