It's official: General Motors (GM -1.85%) will sell its long-troubled Opel subsidiary to French automaker Peugeot S.A. (PUGOY) for about $2.3 billion, in a deal expected to close later this year.

It's clear why Peugeot wants to buy Opel: The combined company could become a powerhouse competitor in Europe. But why is GM selling, after it almost broke even in Europe last year? Here are three charts that tell the tale.

Opel has lost a lot of money for a lot of years

For starters, take a look at the two charts on this slide from a GM presentation explaining the deal. 

A slide showing Opel's market share in Europe and GM Europe's annual losses from 2000 through 2016.

Image source: General Motors.

Taken together, these two charts tell a simple story: Opel has been a mess for years. It hasn't turned an annual profit since 1999 -- in fact, it has lost over $20 billion since then.

But there's more to it than that. 

Back in 2012, GM announced a major restructuring plan that was intended to turn Opel into a sustainably profitable business by 2022. What the two charts show us is that it almost ended the losses, but sustainable profitability was probably still a long way off. 

The chart on the left shows the European market share for Opel and its British sibling brand, Vauxhall, from 2000 through 2016. As you can see, it was declining for years, but it more or less stabilized after 2012. The problem: It stabilized at a low level, and GM's efforts to boost it weren't going anywhere. 

A close-up of the sign on the headquarters building at Opel's engineering center.

Opel's engineering center in Russelsheim, Germany. Image source: General Motors. 

On the right, we see the operating profit for GM Europe over the same period. GM does have some operations in Europe aside from Opel, but they're pretty small: These are essentially Opel's operating results over the period. As you can see, they're all negative -- but again, things were starting to improve after 2012. 

GM has said that if it weren't for the exchange-rate swings that followed the U.K.'s vote to leave the European Union, it would have broken even in Europe last year -- meeting an interim goal set in the 2012 plan. But Brexit happened, and that brings us to the next chart.

Why Opel didn't fit into GM's investment strategy 

This next chart is also from the presentation that GM executives gave on Monday to explain the Opel deal. It's a key to understanding how CEO Mary Barra and her senior team think about the different parts of GM's global business. 

A chart showing GM's principal businesses ranked on profit potential and franchise strength.

Image source: General Motors.

On the vertical axis, we see "franchise strength," GM's relative competitiveness in the area in question. On the horizontal axis, we see "profit potential," probably best thought of in terms of operating profit margins -- profitability, in other words. 

Barra and her team, particularly GM president Dan Ammann, have emphasized that GM wants to steer its investments (in terms of both money and time) toward opportunities that offer the greatest returns. That's a sea change in thinking from the way GM was run for years, but it entirely explains the decision to sell Opel and essentially exit the European market. 

GM wants to put most of its effort into the opportunities shown in green: South America, trucks and SUVs in North America, GM's growing financial-services arm ("GMF"), China, autonomous vehicles and "transportation as a service" ("AV/TaaS"), commercial vehicles, and the Cadillac luxury brand. 

On the other hand, GM is reducing its investments in the areas shown in red, where both GM's franchise strength and profit potential are low. Those include select international markets, as well as car models in North America. 

(The latter requires a note of explanation. GM isn't giving up on selling cars in North America. In fact, it just spent quite a bit of money to launch all-new versions of nearly all of its car models on new architectures that are intended to last until 2025 or later. It will almost certainly launch revamped car models before then, but those new models won't be entirely reengineered, so they won't require huge investments. GM is free to focus its big investments and most of its engineering resources elsewhere for the next several years.)

Finally, we see the businesses GM has decided to exit after seeing no path to what it considers acceptable profitability. Those are shown in black, and now include Opel and Vauxhall.

Summing it up: GM's money and time are better spent elsewhere

What did we learn? We learned that Opel lost a lot of money and market share for a lot of years, that post-bankruptcy GM's best effort at a turnaround almost returned Opel to profitability, and, finally, that GM decided that the money and effort Opel was likely to require over the next few years were more than it was willing to expend given the likely (low) returns. 

That's why GM is selling Opel.