On Jan. 25, a mining dam that sat above Brumadinho, a large town in southeastern Brazil, collapsed and unleashed a tidal wave of waste and mud that engulfed homes, businesses and residents in its path. It killed at least 157 people; 182 are still missing.

It was one of the deadliest mining accidents in Brazilian history — a tragedy, but not a surprise, experts told The Times in an investigation into the dam’s collapse. All the elements of a potential catastrophe had been present, and warning signs overlooked, for years.

The structure, owned by the giant Brazilian mining company Vale S.A., strained the very definition of “dam” — it was an enormous, bare-bones reservoir of mining waste held back by little more than walls of sand and silt. It had no separate concrete or metal to hold back its contents. Instead, the dam relied on the lake of mud to remain solid enough to contain itself.

There are 87 mining dams in Brazil built like the one that failed. And all but four of them have been rated by the government as equally vulnerable, or worse. Even more alarming, at least 27 similarly built dams sit directly uphill from cities or towns, with more than 100,000 people living in especially risky areas if they failed, an estimate by The New York Times found.