Last month, General Motors (NYSE:GM) confirmed that it was negotiating the potential sale of its European operations to PSA Group, owner of the Peugeot brand. Last weekend, GM pulled the trigger.

PSA will buy the Opel and Vauxhall brands, as well as GM's European financing operations. This will leave General Motors with just a token presence in Europe, selling some pricey but low-volume Chevrolet and Cadillac models.

An Opel car park on sand.

GM is finally selling the money-losing Opel and Vauxhall brands. Image source: General Motors.

After factoring in payments related to Opel's pension plans, the General is actually paying PSA to take Opel and Vauxhall off its hands. Nevertheless, this is a savvy, shareholder-friendly move by GM. The key to this deal is its impact on General Motors' cash flow.

Europe is a tough market

General Motors has been on a long losing streak in Europe. The last time it earned a profit there, it was still the twentieth century!

Since 2000, GM has lost nearly $20 billion in Europe. It had initially expected to reach breakeven in Europe during 2016, but the negative impact of Brexit caused it to post a $257 million loss. Due to the ongoing impact of Brexit, General Motors previously disclosed that it would lose money in Europe again in 2017 before hopefully reaching profitability in 2018.

Pundits often contrast GM's perennial losses in Europe to Ford's (NYSE:F) recent recovery in the region. Yet Ford isn't making money hand-over-fist there. While Ford Europe earned a record profit during 2016, its 4.2% operating margin was nothing to write home about. Furthermore, a change in Ford's pension accounting has played a big role in its return to profitability in Europe.

Like GM, Ford expects to face significant Brexit-related headwinds in 2017, leading to a year-over-year earnings decline in Europe. Even in a best-case scenario, Ford hopes to generate a 6% to 8% operating margin in Europe in the long run. By contrast, GM and Ford have often earned double-digit margins in North America in recent years.

In short, Europe is an extremely tough market, even for well-positioned automakers. For an automaker like General Motors that is struggling there now, there isn't much potential upside.

GM dumps its money-losing division

The Opel Mokka crossover parked on the waterfront.

GM's European turnaround plans haven't succeeded thus far. Image source: General Motors.

Given the strong profitability and massive scale of GM's operations in North America and China, the company doesn't "need" to maintain a presence in Europe. Thus, after its latest setback in Europe, the General decided it was time to exit the market.

In theory, PSA is paying about $1.6 billion for GM's automotive operations in Europe. About $700 million of that total will come from warrants to buy PSA shares. Meanwhile, General Motors will sell GM Financial's European arm to a joint venture of PSA and BNP Paribas for about $1 billion.

Offsetting these cash inflows, GM will contribute $3.2 billion to the portion of its European pension plans that PSA will assume. Therefore this transaction will actually result in a net outlay of cash.

Cash is king

Even though GM will spend more to shore up its European pensions than it will receive from PSA, the transaction will free up about $2.6 billion of cash. (This total doesn't include the potential proceeds from selling the PSA warrants that General Motors will receive.)

First, GM will issue $2.8 billion of debt to cover most of its $3.2 billion pension contribution. Management feels comfortable doing this because underfunded pensions are just another form of debt. Second, GM is reducing its target cash balance from $20 billion to $18 billion, to reflect the fact that it will be a smaller and more profitable company going forward.

General Motors will use most of the excess cash for an accelerated share repurchase after the transaction closes.

It will also produce higher free cash flow on an ongoing basis. Even if Opel/Vauxhall reaches breakeven or modest profitability in the next few years, it could still burn cash due to heavy capex requirements. In recent years, Opel/Vauxhall has required more than $1 billion in annual capital expenditures. That could rise going forward as the brands need to reorient their focus from small cars to more desirable crossovers.

By selling off Opel/Vauxhall, GM is abandoning the hope that its European operations could one day generate modest profits like Ford Europe. However, it will free up some cash in the short run and generate about $1 billion more in annual free cash flow for the foreseeable future.

Beyond this cash flow boost, GM will reduce its risk by exiting the ultra-competitive European market. This gives General Motors stock ample upside relative to its current bargain valuation of just six times earnings.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.