By Patrick Markey and Lamine Chikhi
ALGIERS (Reuters) - Former Algerian Energy Minister Chakib Khelil brushes off talk of presidential ambitions. But as he travels from town to town meeting officials and religious leaders, critics say the close ally of ailing President Abdelaziz Bouteflika looks very much as if he is on the campaign trail.
He is not the only one who appears to be maneuvering as debate intensifies over how long the veteran leader, largely out of sight since a stroke three years ago, will stay in office, and who may replace him if he steps aside.
Bouteflika has run the North African OPEC member for nearly two decades, riding out the Arab Spring uprisings of 2011 partly due to fears of a return to chaos after the devastating war between Islamists and the military in the 1990s.
Anarchy in Libya, across the border to the east, is another stark reminder of how political transitions can go wrong.
Succession talk has been spurred by a medical trip to Geneva by Bouteflika in April and an unflattering photograph of him published on Twitter by Manual Valls, prime minister of France, which has a large Algerian community and a strong interest in its former colony.
Bouteflika was last seen openly in public two years ago when he voted from a wheelchair in a ballot in which he won a fourth term. Since then he has appeared only in brief state television videos, usually seated, greeting dignitaries like Ban Ki Moon at the Zeralda presidential residence.
Government officials and ruling party FLN loyalists dismiss doubts over Bouteflika's health, and warn pretenders they will have to wait until the president's term ends in 2019.
"No one will get rid of the president with a photograph on Twitter," FLN chief Amar Saadani told a party gathering. "The president is fine, the country is fine, the party is fine."
Bouteflika was "running the country's affairs properly" and Algerians were aware of his condition when they re-elected him in 2014, said Ahmed Ouyahia, leader of the second pro-government party, Rassemblement National Democratique.
That has not stopped opposition leaders discussing early elections and holding meetings to build a united front against a "power vacuum". Even some Bouteflika loyalists now talk quietly of positioning for his eventual departure.
At 79, Bouteflika is still praised by many Algerians as the man who led the North African state out of international isolation and the "dark years" of the war with armed Islamists that killed 200,000 people.
Talk of transition comes at a sensitive time, with a fall in oil prices hitting state finances, violence in neighboring Mali as well as Libya and the government seeking investment to keep its place as a key European gas supplier.
"The only issue is to return the sovereignty of the people through elections," opposition leader and former candidate Ali Benflis said. "I didn't need to see that photograph to know we have a power vacuum."
Algeria's politics are often opaque, and observers say they have been dominated since independence by behind-the-scenes power struggles over candidates and policies among FLN top cadre, pro-government business elites and generals.
Even before his re-election, Bouteflika moved steadily to erase the influence of the powerful DRS military intelligence service that had often played the role of kingmaker after independence in 1962 and extended its sway during the 1990s war.
Analysts say those bloody years of war mean Algeria's leaders will always prioritize stability over any factional disputes -- whether in any early elections or in 2019.
"The conditions and legal framework for a soft transition are now in place," political analyst Arslan Chikhaoui said. "Anticipated elections or not, Bouteflika's key goal was to make sure Algeria would have evolution and not revolution."
The question of who follows though is still unanswered. That debate, analysts say, risks delaying economic reforms to help shield the economy from the sharp fall in oil prices.
Since his return to Algeria this year after years in exile under the cloud of a corruption scandal, Khelil, a U.S. educated former World Bank technocrat and OPEC president, has been welcomed back by the FLN.
He has always denied the allegations against him and FLN chief Amar Saadani and oil executives hinted he could advise on energy reforms. Local media and opposition figures say he seems to be preparing to be a presidential candidate.
Visiting Sufi monasteries that are influential religious and social centers, especially in rural areas, and talking to the media, Khelil says he only wants to serve his country.
His critics question the timing of his return. Some suggest his tour is an attempt to rehabilitate himself; others say it is a distraction and ask what happened to the corruption probe.
"Let's not be surprised if the next step is forming committees to support Chakib Khelil," newspaper El Watan wrote in a recent column. "What a turnout for a man who three years ago was supposed to meet with the judges."
But Khelil and other potential presidential candidates may be disqualified under articles in the constitution barring those who have lived abroad for a long period or married a foreigner.
Among other names who observers say may emerge from pro-government factions are RND's Ouyahia and the FLN's Saadani, rivals who frequently spar in public, Prime Minister Abdelmalek Sellal, or even an outsider like Lakhdar Brahimi, the former U.N. negotiator who has visited Bouteflika multiple times.
Opposition parties, fractured and weak in the face of FLN dominance, are focused on three leaders -- Benflis, who was once part of the FLN, Said Sadi, founder of a liberal, Berber-focussed party, and moderate Islamist Abdallah Jaballah.
Khelil, like Bouteflika, and many in the president's inner circle, is from the west of the country, and analysts say his return has even stirred rivalries between leaders from west and east dating back to factions who fought against the French.
In Algiers, there is also a court battle over an Arabic-language newspaper between tycoon Issad Rebrab, who is from the east and has been linked to Sadi's opposition party, and the government, which Rebrab says is trying to curb his influence and control the press.
"Those in power, they are worried. They block me because I am not part of their clan," Rebrab, who has clashed with the government in the past, said in an interview in local media.
The communications ministry rejects that and says it has objected to Rebrab's takeover of the newspaper and television station on anti-monopoly grounds and because of media laws. An official told Reuters only the court could decide.
"This is a commercial issue," he said. "I don't understand why Rebrab is saying it is politics."
(Editing by Philippa Fletcher)