Few have argued that these developers knowingly put people in deadly buildings. Mr. Guclu’s own family lived there, after all, as did Mr. Altas’s son. Turkey deemed Mr. Guclu a qualified engineer, and the local government — measured by the number of officials at the grand opening — supported the project.

But the chest-thumping and fanfare were premature. The buildings failed a final inspection, according to court testimony. The nature of the violations is murky, but Ismail Ozturk, a building inspector, testified this year that his company had raised concerns with the local authorities.

Mr. Ozturk testified that the contractors had leveraged “close connections” in the city government to overcome the failed inspection. The city mayor at the time, Ismail Kimyeci, who belongs to Mr. Erdogan’s party, denied any special treatment. He said the government’s final approval had been a formality. “The inspection firm plays the most important role here,” Mr. Kimyeci said.

Mr. Ozturk’s signature does appear on a certification document. Through his lawyer, he said it had been forged.

In a functioning system, there would be no ambiguity about who had approved a project. But Turkey’s system is built on ambiguity. The Erdogan government has, for decades, weakened independent, expert construction oversight and fought proposals to toughen standards.

Turkey’s chamber of civil engineers, for example, has argued for years that experienced engineers are stretched too thin to adequately supervise construction projects. The group has called for every project to get a dedicated engineer. That idea, which could have slowed down construction, went nowhere. The Erdogan government sued the group in 2015, blocking it from issuing its own, stricter certifications for engineers.

Lawmakers also privatized the building inspection process, sidelining Turkey’s engineering and architectural union. And while the government in 2019 eliminated a rule allowing contractors to pick their inspectors, mayors still hold power to push past potential issues.