(Repeats Wednesday item)

* Bouteflika loyalists seen in stronger position

* Purge ousts DRS chief as political kingmaker

* Sensitive time for Algeria after oil price collapse

By Patrick Markey and Lamine Chikhi

ALGIERS, Sept 16 (Reuters) - President Abdelaziz Bouteflika's ousting of a powerful spy chief once regarded as Algeria's "kingmaker" has strengthened the veteran leader's allies and revived speculation over how long he plans to stay in power.

As head of the DRS military intelligence service for two decades, Mohamed Mediene was seen by the public only in rare grainy photographs but won a reputation as a power broker so influential that one of his nicknames was "King of Algeria".

Mediene's removal on Sunday, announced in a terse presidential statement, was the culmination of two years of restructuring, purges and dismissals in the Direction du Renseignement et Securite by Bouteflika.

It may also be a final purge in a struggle for influence among the military intelligence and civilian old guard, widely seen as rival factions since the uprising against French colonial rule in the late 1950s.

"End of an Era" screamed the front page of El Watan newspaper. Describing the departure of the rarely-seen spy chief, Liberte daily said: "The Myth has crumbled."

Bouteflika, 78, has also been seen in public infrequently since surviving a stroke in 2013. Even after his re-election for a fourth term in April 2014, he has appeared only in brief television recordings, fueling speculation about his intentions.

But curbing the DRS' influence means effectively that Bouteflika loyalists now hold more sway, analysts and opposition leaders say, and that may allow the independence war veteran to eventually step aside for an ally.

"We could be seeing the way to a succession. These changes are nothing more than the result of a battle of clans that has led to the victory of one over the other," said Soufiane Djilali, leader of the opposition party Jil Jadid.

Mediene's departure comes at a sensitive time for Algeria, a top gas supplier to Europe and a partner in the Western campaign against Islamist militancy in the Sahel area of north Africa, as there are questions over whether Bouteflika has the stamina to finish his fourth mandate, due to end in 2019.

Officials and diplomats say Bouteflika, who rose to power in 1999, has his mental faculties but is physically frail, and appears in a wheelchair when he greets foreign dignitaries.

A fall in global oil prices has officials fretting over finances and heavy state spending as the oil and gas revenues that fund 60 percent of Algeria's budget slide as petroleum prices fall.

Presidents and parliament are elected, but Algeria's politics has mostly been dominated by old guard veterans from the National Liberation Front or FLN party, business elites and military generals competing for influence.

But even with their internal rivalries, political analysts say Algeria's rulers have prized stability above all since the upheaval that followed a war with armed Islamists in the 1990s that killed 200,000 people and left Algerians wary of turmoil.

Should Bouteflika step side, among names now touted to succeed him are Abdelkader Bensaleh, 75, the chairman of the senate. He is a Bouteflika loyalist and is seen as a candidate of continuity, political analysts say.

Other potential candidates are Prime Minister Abdelmalek Sellal and Lakhdar Brahimi, 81, the former U.N. negotiator and a close associate of the president who has visited Bouteflika frequently in recent months.

"If there is any big implication from Mediene's departure, it's that the power struggle for the presidency is likely over," said Geoff Porter at North Africa Risk Consulting.

"Whatever one may think of President Bouteflika and Mohamed Mediene, uncertainty regarding the presidency hamstrung Algeria for the last two years, if not more."



CIGARS AND COUNTER-INSURGENCY

Little has been made official about Mediene's background. The rare pictures of him show a bespectacled man, cigar in hand - he had a fondness for Cuban cigars - in a tweed jacket looking more like a school teacher than a KGB-trained spy chief.

Security sources say he joined the army in 1957 during the war against colonial France and became an officer after independence when he also trained in Russia.

But his rise to power and influence paralleled times of flux in Algeria, peaking during the 1990s war against armed Islamists when violence ravaged the countryside and bombings and assassinations in the capital were common.

At that time, analysts say, the DRS under Mediene extended its influence to ministries, government offices, newspapers and opposition parties under the name of national security.

But security sources say Bouteflika has slowly eased the military out of the political sphere since returning from months in a Paris hospital after his stroke in 2013. First generals were fired, and more recently a decree ended DRS posts in government and ministry offices.

Political considerations, though, may also be giving way to security concerns as Algeria looks at how to shore up its own defences against the instability in the region, particularly from Islamist militant threats across its borders.

Many of the reforms of the DRS have been led by Gaed Saleh, Algeria's deputy defence minister, chief of staff and a Bouteflika loyalist. He has transferred important DRS duties to the army command, according to security sources.

General Athmane Tartag, who has replaced Mediene, is also a former Bouteflika security advisor and an expert in fighting armed groups. He was instrumental in dismantling several cells of the hardline Islamist militant group GIA in the 1990s.

"Algeria is facing new security threats including terrorist groups based in Libya, and Mali trying to cross into its territory," local security analyst Arslan Chikhaoui said. "That means intelligence needs to be more focused and stop getting involved in politics."

((pat.markey@thomsonreuters.com; +21620349006; Reuters Messaging: pat.markey.thomsonreuters.com@reuters.net))