MOBILE, Ala. — Thousands of hungry and unwashed passengers gathered on the decks of the lifeless Triumph cruise ship, singing “Sweet Home Alabama,” waving towels and cheering as the vessel was pulled into dock here late on Thursday. For 4,200 passengers and crew, the fetid ordeal of five days adrift in the Gulf of Mexico was over.

But for the ship’s owner, Carnival Cruise Lines, with headquarters in both Florida and England, the real work was just beginning.

There were the immediate concerns, among them how to get the passengers home once they got off the ship, a process that was set to begin shortly after the ship docked Thursday at 9:30 p.m. Central time. Also at issue was how and why a fire came to knock out the propulsion system, the power, and the sewage, heating and air-conditioning systems on the 14-year-old ship, which had mechanical troubles last month that delayed a similar cruise to Mexico.

Company officials said the two episodes were not related, but their proximity may help inspire a wall of legal actions from passengers, experts said.