The US administration has repealed a measure granting automatic residency to virtually every Cuban who arrived in the country, whether or not they had visas, ending a long-standing exception to US immigration policy.

The end of the "wet foot, dry foot" policy, which allowed any Cuban who reached US soil to stay but returned any picked up at sea, is effective immediately as of Thursday.

Cuban officials had sought the change for years. Washington and Havana spent several months negotiating the change, including an agreement from Cuba to allow those turned away from the US to return.

Inside Story - Can the US and Cuba trust each other?

It was announced abruptly because advance warning might have inspired thousands more people to take to the seas between the Communist-ruled island and Florida in order to beat a deadline.

"With this change we will continue to welcome Cubans as we welcome immigrants from other nations, consistent with our laws," Obama said in a statement.

Al Jazeera’s Andy Gallacher, reporting from Miami, said Cubans there seemed to be divided over the issue.

"The ones who supported the normalisation process say that Cuba now will take Cubans back to the island; not leave them stateless or put them in jail. To them, this is a huge improvement," he said.

"However, some others are simply worried about what will happen to people who want to leave Cuba and get a better life in the US."

The US Coastguard intercepts thousands of Cubans attempting the 145km crossing to Florida every year, but tens of thousands who reach US soil, including via Mexico, have been allowed to stay in the country, while immigrants from other nations have been rounded up and sent home.

Cuba welcoming move

Cuba welcomed the policy changes, saying they would benefit the whole region by discouraging people-trafficking and dangerous journeys that led to bottlenecks of Cubans in Central America last year.

"Today, a detonator of immigration crises is eliminated. The United States achieves legal, secure and ordered migration from Cuba," said Josefina Vidal, the Cuban foreign ministry's chief for US affairs.

Julia Galiano, reporting from Havana for Al Jazeera, said the development was seen by the Cuban government as a definite victory.  

"To Cuban government, this was something very high on their priority list. Havana said that with this policy in place, there was no point in two countries trying to normalise relations," she said.

"Cuba has also long said this policy encourages illegal and dangerous immigration to the US."

IN PICTURES: Changing face of Cuba

Anticipating the end of the policy, Cuban immigration has surged since the 2014 normalisation, said Ben Rhodes, Obama's deputy national security adviser.

"People were motivated to migrate," Rhodes told reporters, noting that some 40,000 Cubans arrived in 2015 and about 54,000 in 2016.

People & Power - Cuba for Sale

The administration had rejected Cuban requests to overturn the policy before Obama's historic visit to the island last year, although even some White House aides argued that it was outmoded given efforts to regularise relations between the former Cold War foes.

"Wet foot, dry foot" began in 1995 under President Bill Clinton after an exodus of tens of thousands of Cubans who were picked up at sea by the coastguard as they tried to reach Florida.

Obama has been working to normalise relations with Cuba since he and President Raul Castro announced a breakthrough in diplomatic relations in December 2014.

The move to end the policy comes just eight days before the Democratic president turns the White House over to Republican Donald Trump, who has said the US should get more concessions from Havana in exchange for improved relations.

Inside Story - US-Cuba: Foes no more

Source: Al Jazeera and news agencies