BUDAPEST — Long before Hungary’s worst boating accident in at least six decades, Hungarian officials had been warned that traffic on the Danube had soared to dangerous levels around Budapest, but the government did not curb the number of vessels plying the river.

On the night of May 29, in a driving rain, an international cruise ship, the Viking Sigyn struck and sank a smaller sightseeing boat, the Mermaid, killing 28 people. The cause is still under investigation, but the accident has raised concerns that at the municipal and national levels, where tourism has become a major source of revenue, political calculations and the drive for profit outweighed safety concerns.

Either the national government or the city, both controlled by Prime Minister Viktor Orban’s Fidesz party, could have acted to limit the number of ships and boats operating in Budapest; the national tourism agency grants permits to sightseeing vessels, while the city controls access to the docks.

“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.”