A New York judge has issued an order preventing the deportation of people who have been detained as a result of the visa ban issued by US President Donald Trump on people from seven Muslim-majority countries.

Crowds at JFK Airport erupted in cheers as they heard the news, following hours of protests over the detention of 12 people at the airport as part of the executive order signed by the Republican on Friday (27 January).

District Judge Ann Donnelly issued the ruling following a lawsuit brought on behalf of two Iraqi men who were detained at JFK Airport, The New Civil Rights Movement reported. However, it is believed that the ruling applies only to those people currently detained at US airports or those who are in transit.

The protests began in the morning on 28 January, after it emerged that two Iraqi refugees and 10 other people were held at the airport – with crowds of demonstrators swelling as the day progressed and other protests taking place at international airports across the US including in Dallas, where at least nine people were detained.

The people were held after Trump announced a 90-day moratorium on entry to the US for people from Iran, Iraq, Yemen, Sudan, Libya and Somalia, as well as an indefinite ban on refugees from Syria.

Despite Trump's insistence the visa ban is not a Muslim ban, many of his critics believe it is a de facto Muslim ban – similar to what Trump proposed during his presidential election campaign.

Protesters held sign boards at the airport calling for an immediate retraction of the ban, as some held banners that read "refugees are welcome here", and cheered the news that a judge had blocked the deportation of people being detained at the airport.

Two Iraqi refugees who were held at JFK have now have been released, according to their lawyers, who are filing a lawsuit against Donald Trump over the incident.

But the lawyers claim "dozens and dozens" of people were being detained at the airport, CNN reported.

Among those protesting were lawyers, who held signs and promised free legal advice to those who were worried about the visa ban, as well as New York taxi drivers, who stopped picking up people from the airport and also released a statement underlining their support for protesters.

The president has hit out at claims the visa ban is a ban on Muslims, and said it is working out well so far, without addressing the crowds that had gathered at JFK Airport.

"I'm establishing new vetting measures to keep radical Islamic terrorists out of the United States of America," Trump said when signing the executive order, The Hill reported.

"We don't want them here. We want to ensure that we are not admitting into our country the very threats our soldiers are fighting overseas. We only want to admit those into our country who support our country and love deeply our people."