Mexican President Enrique Pena Nieto has signed a controversial law that allows foreign companies to drill for oil for the first time since the sector was nationalised in 1938. The legislation was passed by Congress on 13 December and ratified by a majority of Mexican states. President Pena Nieto says the reform will help Mexico attract the investment needed to boost its falling oil output, the BBC reported. The legislation changes three articles in the Mexican constitution and allow foreign investment in oil, gas and electricity. Private companies will be allowed to sign contracts to drill for oil and gas with state-controlled firm Pemex, which will get a share of the profits. "This is the beginning of a new history for our country. We have opened the doors for a better future for all," said Pena Nieto. Oil production in Mexico has dropped from 3.4 million barrels per day in 2004 to the current rate of 2.5 million barrels per day. The opposition says it damages national interests.