Image copyright Getty Images Image caption US President Donald Trump's travel ban was met with protests and legal challenges

People denied entry to the US under Donald Trump's first travel ban can now reapply for visas following a legal settlement reached in a federal court.

The US government will now contact individuals turned away at borders as a result of the executive order that came into force on 27 January.

The agreement does not guarantee that applicants will receive new visas.

Mr Trump signed the original order in January barring people from seven Muslim countries from entering the US.

The move sparked numerous protests and legal challenges.

Mr Trump later defended the executive order, saying it was "not a Muslim ban".

A week after it was implemented, a federal judge in Seattle suspended it nationwide, allowing banned visitors to travel to the US, pending an appeal by the administration.

The new legal agreement, which was announced on Thursday, obliges the US government to act in "good faith" when processing the paperwork of all applicants.

The seven countries affected by the initial 90-day travel ban were Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen. Iraq was later removed from the list.

Some visa categories, such as diplomats and UN workers, were not included in the suspension.

Among the individuals initially barred from entry to the US were two Iraqi nationals; Hameed Khalid Darweesh and Haider Sameer Abdulkhaleq Alshawi.

They were stopped and detained on arrival at John F Kennedy airport in New York.

Human rights groups, including the National Immigration Law Centre (NILC) and the American Civil Liberties Union (ACLU), filed a lawsuit in New York to demand the release of the two men, who were in the air bound for the US when the executive order was signed.

Mr Darweesh, who had worked as a US Army interpreter, was later released by border officials.

Image copyright @NydiaVelazquez Image caption Hameed Khalid Darweesh, centre, was detained at JFK airport in January

"Although the government dragged its feet for far too long, it has finally agreed to do the right thing," said Lee Gelernt, of the American Civil Liberties Union (ACLU).

The settlement, Mr Gelernt says, provides those excluded under the first Muslim ban with "proper notice of their right to come to the United States".

He added that while this was progress, the "legal fight against Muslim ban 2.0" would continue with a Supreme Court hearing in October.

Hundreds of nationals from the countries affected by the ban in January were detained on arrival despite having valid visas and residency documents.

The move was suspended on 3 February after it was challenged in court.

On 6 March, Mr Trump attempted to revise the ban on individuals from the six countries to include grandparents and other relatives of US residents.

In July, the US Supreme Court rejected the Trump administration's revised executive order but judges gave the government the right to enforce a separate ban on refugees, pending a government appeal against a federal court order.