A US federal judge has struck down an immigrant visa policy that affected nationals of 75 countries, including Nigeria, ending a seven-month suspension of visa processing for applicants from the countries.

Judge Jeannette Vargas issued the ruling on Friday in New York, finding that the policy was “contrary to law” and that Secretary of State Marco Rubio had exceeded his legal authority in implementing it.

The US Department of State ordered consular officers in January to pause immigrant visa processing for nationals of the affected countries while the government carried out a wider review of screening and vetting procedures.

The policy was tied to the US government’s use of the “public charge” provision in immigration law, which allows visa applications to be denied when authorities determine that an applicant is likely to depend on certain public benefits.

Nigeria was among the countries affected, alongside Ghana, Cape Verde, Barbados, Afghanistan, Brazil, Egypt, Iran, Iraq, Somalia, Thailand and Yemen.

The State Department had defended the measure as necessary to prevent immigrants from high-risk countries from unlawfully using welfare programmes or becoming a public charge in the United States.

However, Vargas ruled that consular officers could not be instructed to deny immigrant visas solely because of an applicant’s country of origin after determining that the applicant otherwise qualified for a visa.

The US government may appeal the decision.

The ruling provides a reprieve for Nigerian applicants and others affected by the suspension, although the final outcome will depend on whether the administration challenges the decision in a higher court.

Since returning to office, President Donald Trump has made immigration enforcement a central part of his administration, introducing measures aimed at tightening border controls, visa screening and eligibility for entry into the United States.