HAVANA — A British cruise ship that was turned away from several Caribbean ports after passengers fell ill with novel coronavirus is scheduled to dock in Cuba Tuesday after the island agreed to help transfer those aboard to planes bound for the United Kingdom.

The Cuban government said it had decided to allow the Braemar to dock in the port of Mariel, about 35 miles west of the capital, “due to the urgency of the situation and the risk to the lives of sick people.”

Fred. Olsen Cruises said that the ship had 22 passengers and 21 crew members in isolation after displaying flu-like symptoms and five aboard who tested positive for the new coronavirus.

The ship with more than 1,000 people aboard has been turned away from ports in Curacao and Barbados in recent weeks, leading to an intense search for a way to get its mostly British passengers and its crew home.

Meanwhile, two cruise ships were denied permission to return to their home port in San Juan, Puerto Rico, two cruise lines said Monday. Both the Royal Caribbean Cruises’ Freedom of the Seas and the Carnival Fascination are instead sailing to Miami, where passengers are expected to disembark.

The Carnival Cruise Line said the government of Puerto Rico even denied a request to debark Puerto Rican residents “despite the fact that no one has any influenza-like illness.”

“We have plenty of food, fuel, water and supplies and a full schedule of entertainment and activities,” Carnival Cruise Line said in an emailed statement.

Carnival said it had already obtained approval from port and federal officials to dock in Miami on Tuesday.