Repsol SA’s (OTCMKTS:REPYY) board decided to accept a nearly $5 billion settlement for Argentina’s release of government control over the company's YPF SA (NYSE:YPF) unit, ending a conflict that had been going on for two years, Repsol’s board announced Tuesday.

The agreement will require an approval from Repsol shareholders and the Argentine Congress. According to the agreement signed by the companies, Argentina will pay Madrid-based Repsol dollar-dominated bonds worth $4.67 billion, which Repsol can sell anytime it wishes to. If it earns more that $5 billion from the sale of the bonds, which usually trade at a steep discount, it will return the excess amount back to the Argentinean government.

“This is very positive. Repsol still has a 12 percent stake in the company, there should be a new dynamic now in the board. We should be able to leave this dispute in the past and focus on a more constructive future,” YPF CEO Miguel Galuccio reportedly said, according to Bloomberg.

In April 2012, Argentine President Cristina Fernandez de Kirchner’s government had taken over 51 percent of YPF, which according to Reuters, was created in the 1920s by the country's government and privatized in the 1990s. Repsol had initially sought $10.5 billion in compensation from Argentina over the issue. As part of the settlement, Repsol will drop all lawsuits against Argentina and waive future legal claims.

According to Bloomberg, the resolution to the dispute may lead to the development of some of the world’s largest shale fields by investors.

"I think to finally reach a friendly agreement on this contentious issue that has taken two years is extremely positive. As far as we are concerned, from a financial point of view, we have started a new chapter where we are stronger," Antonio Brufau, Repsol's chairman said, according to BBC. Repsol produces about a third of Argentina’s oil requirements and a quarter of its gas needs.

According to Reuters, analysts have indicated that the $5 billion settlement could add up to 3 euros to Repsol’s share price.