* "Economic patriotism" restricted foreign investment
* But govt now eager to boost revenues, speed growth
* Draft energy law signals change of tack
* Attitude to foreign firms' M&A becomes more liberal
* New prime minister pushing foreign investment
ALGIERS, Jan 16 (Reuters) - At a factory near Algeria's western city of Oran, cars made by Renault are expected to start rolling off an assembly line late next year. It will be an important moment for the Algerian economy.
The French auto giant abandoned its last Algerian factory 43 years ago after the plant was nationalised in the wake of the country's independence from France in 1962.
Now Renault is returning, lured by a shift in government policy. After decades in which officials tightly restricted foreign investment - a policy most recently known as "economic patriotism" - they are gradually opening the economy to capital from abroad.
About 400,000 new cars are sold in Algeria annually but the country imports the vast majority as it has no mass-production auto plants. The government hopes Renault's factory, a joint venture with local interests under a deal signed last month, will launch a domestic auto industry that ultimately creates thousands of jobs.
"After years during which economic patriotism has been implemented with little success, Algeria is back again to a market economy - not because it loves an open economy, but because it has to have one, to create enough jobs," said Arslan Chikhaoui, a local economist who owns a consultancy.
As recently as 2008, President Abdelaziz Bouteflika publicly denounced foreign investors for exploiting Algeria's resources without reinvesting some of their profits in the country. The government subsequently imposed new taxes on the operations of foreign firms.
The aversion to foreign capital stemmed partly from the socialist roots of post-independence governments, and partly from suspicion of Western economic dominance.
Now, however, Algeria - like all countries in the region - is being forced by the Arab Spring uprisings to rethink its economic policies. Although it has avoided major political unrest, it was shaken in 2011 by a series of riots demanding better living conditions.
The government responded by ramping up spending to ease social discontent, offering pay rises to millions of state employees and providing free loans to help young people launch small businesses.
That has pushed state finances into the red. Algeria is heavily dependent on exports of oil and gas, but they have stagnated over the past five years; the government would need an oil price of $121 per barrel to balance its books, the International Monetary Fund estimated in November.
So authorities have been forced to look for new ways to expand revenues and stimulate the economy - and foreign capital looks like the best bet, partly because it comes with modern technologies and access to foreign markets.
The government's new direction can be seen in an energy bill now being debated by parliament. The bill, which looks likely to pass as the government has a big majority in parliament, would abolish a windfall tax on foreign energy firms and replace it with another levy that is expected to be less onerous.
The draft also offers fiscal incentives for foreign companies that invest in offshore exploration and unconventional energy projects, though Algerian state firm Sonatrach would remain majority partner in all upstream and downstream projects.
"The government is doing its maximum to improve the sector's attractiveness to secure high oil revenues," a government official, who asked not to be named under briefing rules, told Reuters.
He added that increasing export revenues was important because Algeria imported many of its basic needs, including food, medicine and machinery. The first test of the bill's effectiveness is likely to come later this year, when the government is expected to invite bids for new energy projects.
Under Algeria's previous approach, mergers and acquisitions activity by foreign investors was vulnerable to official interference. When Egypt's Orascom Telecom wanted to sell its lucrative Algerian unit Djezzy to South Africa's MTN in 2010, the government blocked the deal, saying a 2009 law gave it the right to buy the asset in the event of any sale.
But when Qatar Telecom boosted its stake in Kuwaiti telecommunications firm Wataniya last October, the Algerian government did not seek to use the law to take control of Wataniya's local unit. Analysts said this indicated an increasingly liberal stance by the government.
"This is new behavior, showing that there is change in the air - it did the contrary with Orascom Telecom a few years ago," said Chikhaoui.
The government also refrained from any action when U.S. oil and gas firm ConocoPhillips struck a deal last month to sell its Algerian business unit to Indonesia's Pertamina for about $1.75 billion.
Algeria will not abandon all of its investment restrictions overnight. In order to secure the Renault deal, for example, it agreed that other foreign auto makers would not be allowed to establish factories for three years.
But analysts said the appointment of a new prime minister last September appeared to have built up irreversible momentum for reform.
The previous prime minister, Ahmed Ouyahia, was once seen as a potential successor to Bouteflika in 2014, but he has now been sidelined, resigning from his position as leader of the National Rally for Democracy (RND), one of the ruling parties, after intense pressure from senior members of the party.
Ouyahia's opponents attacked his economic record and specifically his failure to bring in foreign investment, which they said hurt efforts to find jobs for young Algerians. The unemployment rate is officially estimated at 10 percent.
Abdelmalek Sellal, Ouyahia's replacement, is seen as more of a technocrat. He has stressed the need to facilitate foreign investment and simplify rules covering it, saying: "Foreign expertise...is absolutely essential for us, given that the transition towards a market economy is complex and difficult."
Geoff Porter, director of North Africa Risk Consulting, said Sellal was "accessible and interacts well with the international business community, demonstrating an awareness of their concerns and their interest in Algeria."