HAVANA (AP) — The U.S. Coast Guard says 38 migrants from Cuba who had been stuck in a legal limbo aboard a U.S. Coast Guard ship have been sent home to Cuba.

Coast Guard Petty Officer Mark Barney says the group was repatriated Sunday morning, ending weeks of waiting.

The migrants detained in April ordinarily have been quickly repatriated under an agreement between the U.S. and Cuba intended to discourage risky sea journeys by people seeking to reach the United States.

But a U.S. official said Cuban authorities had balked at accepting the 38 because they had left the country legally, with tourist visas from the Caribbean nation of St. Lucia. The migrants were held on board the Coast Guard cutter Vigilant until the situation was resolved.

Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.

Join our Newsletter for the latest news right to your inbox