BUDAPEST — The warnings came before a ship called the Mermaid set out on May 29 in driving rain for a nighttime tour of Budapest. Before the much larger Viking Sigyn struck the Mermaid, capsizing and sinking it in seconds. Before 28 people died in Hungary’s worst boating accident in at least six decades.

Traffic on the Danube had soared to dangerous levels, and in particular, there were far too many tourist ships. Ship captains and official reports tried to sound alarms, but the government refused to impose new limits.

“City officials were warned about the dangers of too much traffic,” said Gabor Demszky, the mayor of Budapest from 1990 to 2010. “But they failed to act. It is a very profitable business.”