Boeing Co.’s approach to making the 737 Max was supposed to save money and help it compete with rival airplane maker Airbus.

Instead, the design created a crisis that killed hundreds of people, ate up billions of dollars, angered airlines and regulators, and cost Chief Executive Dennis Muilenburg his job.

Muilenburg became CEO in 2015 — a few years after the company decided to create the Max by modifying its 1960s-era 737 airplane design rather than devising a modern passenger jet from scratch. But he was at the helm when an engineering quirk and a single tragic accident blossomed into a catastrophe that has consumed the company.

After a 737 Max crashed in Indonesia in October of last year, killing everyone on board, Muilenburg seemed to point blame at the pilots, and Boeing simply issued a notice saying flight crews should follow a safety checklist. Less than six months later came the deadly crash of a 737 Max in Ethiopia and the subsequent grounding of the plane worldwide.

Boeing has endured a steady stream of bad publicity as details emerge about how the company handled the system that caused the crashes. Muilenburg has also riled the Federal Aviation Administration as the agency investigates the accidents, and the once-cozy relationship between the company and the regulator has deteriorated.

On Monday, Boeing announced that Muilenberg would be replaced.

“He was becoming seen as not only a public relations obstacle but a regulatory barrier,” said Jeffrey Sonnenfeld, senior associate dean for leadership studies at the Yale School of Management.

In 2011, Boeing’s airplane business was in disarray.

Two of its major passenger jet programs — the new, fuel-efficient 787 Dreamliner and the 747-8 Intercontinental — were behind schedule and over budget. On top of that, rival Airbus was wooing stalwart Boeing customers such as American Airlines with its single-aisle A320neo plane.

To counter Airbus and save on development costs, Boeing announced it would outfit its old 737 with a new engine and a new name: the 737 Max. The company’s chief financial officer at the time said that would cost only 10% to 15% as much as designing a whole new plane.

Now, of course, the costs incurred by the 737 Max saga may outstrip the expected savings.

The two crashes killed a total of 346 people. There’s no telling when the Max will be cleared to fly again, which has put a dent into the plane’s sales and airlines’ flight schedules. The company faces congressional scrutiny and a criminal investigation for its handling of the incidents and the plane’s development.

The company estimates that the situation could cost it at least $9.2 billion. And it’s losing sales to Airbus. In October, Airbus’ A320 overtook the 737 in total orders for the first time.

“I really fully understand all the reasons that went into it,” Scott Hamilton, aviation industry consultant with analysis firm Leeham Co. in Washington, said of the Max design. “But obviously in hindsight, they should have taken a different direction. They could have built two airplanes for what it may wind up costing them.”

The original 737 design, which debuted in 1967, was low to the ground with foldable metal stairs that attached to the fuselage for passenger boarding. That low profile was good in the days before airport jetways, but it has since become a constraint Boeing engineers have had to work around.

As Boeing looked to modernize the plane, it added larger and more powerful engines to accommodate a bigger fuselage and more passengers. But engineers had to place those larger engines in a different position than the previous engines so the plane could clear the ground.

The new location changed the plane’s center of gravity and could cause the plane to pitch up under certain circumstances. To counteract that, engineers added the now-infamous flight control software known as the Maneuvering Characteristics Augmentation System, or MCAS.

That software was implicated in the 737 Max crashes in Indonesia and Ethiopia after it received faulty information from a sensor and pushed the planes’ noses down into a fatal dive.

After the crashes, the nation learned more about actions taken at Boeing during Muilenburg’s tenure.

In 2016, the chief technical pilot for the 737 Max expressed misgivings about the MCAS system. But the company went ahead with it and then successfully petitioned the FAA to take mentions of the system out of the plane’s flight manuals, arguing that it was benign. After the crashes, Boeing became aware of messages describing those concerns — but it waited months before giving those messages to FAA investigators.

The company also has exasperated the FAA in recent months by offering too-optimistic predictions of when the regulator would clear the Max to return to the skies.

In addition to the 737 Max crisis, Boeing has faced delays on its KC-46 aerial refueling tanker, which had problems with a camera system that helps the plane refuel other military jets.

Then on Friday, Boeing’s Starliner capsule — which is expected to carry NASA astronauts next year — failed to reach the International Space Station on its first test mission after a faulty timer threw off the craft’s autonomous functions.

Although these incidents are distinct, they suggest that the company has moved away from the engineering-first mind-set it was once known for, said Jeff Yastine, equities analyst at investment advice site Banyan Hill Publishing.

“It really has become a crisis of confidence,” he said.

Boeing said in a Monday statement that the leadership change was “necessary to restore confidence in the company moving forward as it works to repair relationships with regulators, customers, and all other stakeholders.” Chairman David Calhoun was named president and CEO.

While the timing of Muilenburg’s ouster was unexpected — in a crisis, companies typically try to maintain stability — the move can be seen as a symbolic one.

“Boeing has mishandled it all,” Hamilton said, adding that Muilenburg was “the face of Boeing. All that falls under his watch.”