Following an announcement in early July that the Volkswagen Group was purchasing the remaining 50.1 percent stake in Porsche from the sports car manufacturer’s holding company owner, Porsche SE, the complex deal has now been finalized.

In accordance with the original agreement, Volkswagen now holds 100 percent of the shares of Porsche via an intermediate holding company. The total cost of the deal was 4.46 billion euros (approximately $5.6 billion), which included about €3.88 billion ($4.75 billion) for the remaining 50.1 percent stake and the rest going to cover some adjustment items.

Though Volkswagen has been closely linked with Porsche since the company’s founding more than half a century ago, the complete integration of the two companies now means that they will be able to implement joint strategy more quickly. Importantly, Porsche will still be run independently, in line with Volkswagen’s decentralized management structure.

“Porsche will retain its own identity and operational independence, just like all of the other group brands", Volkswagen Group CEO Martin Winterkorn said in an official statement.

This ends a five-year ordeal that almost saw Porsche SE, the holding company, take control of the entire Volkswagen Group. In the early part of 2007 Porsche SE started increasing its ownership in Volkswagen, and by 2009 Porsche SE’s stake in Volkswagen had increased to 50.76 percent and a takeover was looming.

Unfortunately for Porsche SE, German state laws and its own mounting debts (which it used to finance the original purchase of the Volkswagen shares) ultimately forced it to turn to Volkswagen for help, leading to Volkswagen’s own purchase of Porsche stock.

The failed takeover attempt not only cost then Porsche CEO Wendelin Wiedeking his job, but it also cost investors billions once it became known. At one point Volkswagen’s share price was trading at more than $1,250, making it the world’s most valuable company at the time, however, the price dropped the next day due to negative reaction of the failed takeover and short-sellers who had been betting on Volkswagen shares to fall.