A major new refinery due to begin operating next year will help Mexico to achieve energy independence and stop exporting crude oil, President Andres Manuel Lopez Obrador said Friday.

Lopez Obrador cut the red ribbon at a ceremony in his home state of Tabasco billed as the inauguration of the first phase of the Olmeca refinery, which will now undergo tests.

He said the facility was "a dream come true" and would be able to process 340,000 barrels of oil a day, with the aim of making Mexico self-sufficient in gasoline and diesel.

"We will keep our word to achieve energy independence," Lopez Obrador said at the event, which coincided with the fourth anniversary of his 2018 presidential election victory.

It is the first time in more than 40 years that a new refinery has been built in Mexico, the leftist leader said.

The final construction cost of the facility in the Gulf coast oil port of Dos Bocas is expected to be around $12 billion dollars — far above the $4.0 billion dollars initially envisaged.

Mexico produces around 1.7 million barrels of crude oil per day, but a lack of refinery capacity means that it still has to import fuel products.

One of Lopez Obrador's campaign pledges was to reduce energy prices and his government has used surplus oil revenues to subsidize fuel.

Even so, motorists are facing rising prices at the pump, adding to worries about inflation.

In January, Mexico's state-owned energy giant Pemex finalized the purchase of a refinery in Deer Park in the US state of Texas that the government says will also refine 340,000 barrels of crude a day.

Environmentalists opposed to the Olmeca refinery warned that it would set back efforts to reduce greenhouse gas emissions to tackle global warming.

"Mexico continues to undertake actions that distance it from fulfilling its national and international climate commitments," the advocacy group Nuestro Futuro (Our Future) said.