Barack Obama said that immigrants to the US are being demonised in the same way as Irish people who arrived in America after the Famine.

In his first public speech since leaving office, the former US President said the Irish were treated like the “other” in the 19th century just like Muslims are today. Mr Obama drew parallels between the two periods in American history and that in both immigration policy was “‘driven by biases”.

On Monday Mr Obama held his first public engagement since leaving office, addressing a group of about 400 students and activists at the University of Chicago in his adopted hometown.

Addressing the issue of immigration, which has come to the fore as Donald Trump tries to introduce stricter controls, Mr Obama said: “I always used to say in crowds where folks didn’t want to hear it, it’s not like everyone in Ellis island had their papers straight.

“The truth is the history of our immigration system has always been a little bit haphazard, a little bit loose, a little bit determined by did the country want more workers, economic imperatives, sometimes it was driven by biases.

“If you look at what was said about (the) Irish when they were coming here in the wake of the potato famine they talked about them the same way you hear people talking about immigrants today.

“This is an example of where everybody being able to see the realities of immigrants as people, not as as some ‘other’ is important”.

Some 1.5 million adults and children left Ireland between 1845 and 1855 bound for America due to the Famine. Those who survived the journey arrived in cities like Boston and New York where they were laughed at as they disembarked because of the state of their clothes. Irish immigrants were discriminated against because of their Catholic religion and were forced to take unsafe manual labour, often working on the docks.

Unlike previous presidents, Mr Obama and his family chose to stay living in Washington DC after his term ended while their younger daughter Sasha finishes high school.

While they are renting a nine-bedroom house in the exclusive suburb of Kalorama, around the corner from president Donald Trump’s daughter Ivanka and her husband Jared Kushner, the Obamas have kept a low-profile in the capital.

This week marks his return to the public eye.

“What’s been going on while I’ve been gone?” he smiled, as he took to the stage in Chicago. But his supporters may have been left disappointed by his decision not to directly mention Mr Trump during his appearance.

Instead of jumping back into the political fray, Mr Obama instead stressed the importance of civic engagement and public participation in politics. Noting that statistics show that people are less likely to be involved in their community than before, he said that “we’ve become a more individualistic society.”

“The single most important thing I can do is to help in any way I can to prepare the next generation of leadership to take up the baton,” he said.

The closest he came to criticizing his predecessor was during the question and answer session when he compared current prejudices towards immigrants as to how the Irish were perceived in the nineteenth century.