MEXICO CITY (Reuters) - Mexico said on Friday it would grant residency permits to 588 Cubans who were stranded in the north of the country after the United States ended its “wet-foot, dry-foot” policy, which had given legal status to almost every Cuban to reach U.S. soil.

Mexico’s National Institute of Migration (INM) said the beneficiaries of the program are currently in the city of Nuevo Laredo, Tamaulipas, on the border with the United States, where the group was headed.

“INM has done everything to allow this group of foreigners of Cuban origin to obtain their residency in the country for humanitarian reasons,” the institute said in a statement.

The permit will initially be granted to 273 Cubans who will also be allowed to work, the statement said, adding that the migrants had not obtained refugee status or political asylum.

Former President Barack Obama ended the “wet-foot, dry-foot” policy in January shortly before leaving office, stranding hundreds of Cubans who were seeking a new life in the United States in Mexico and Central America.

Under the so-called “wet-foot, dry-foot” policy, Cubans who made it to U.S. soil were allowed to stay while those caught at sea were sent back to Cuba.