Algerian President Abdelaziz Bouteflika has replaced the long-standing head of Algeria's military intelligence agency, in his latest move in a campaign to curb the spy chief's influence in politics.
The removal on Sunday of Mohamed Mediene, chief of the intelligence service for more than two decades, sidelines a powerful figure in the country.
Known by his nickname Toufik and seldom seen even in photographs, Mediene had long played the role of political kingmaker, analysts said, influencing leadership choices in Algeria's backroom tussles between civilian and military factions within the leadership.
Mediene was replaced by General Athmane Tartag, a specialist in fighting against armed groups who also served as Bouteflika's security advisor.
Related: How serious is ISIL threat for Algeria?
"The president of the republic, Abdelaziz Bouteflika has ended the duties of the chief of the Department of Intelligence and Security," a presidential communique said, naming Tartag as his replacement.
Bouteflika began easing the military and its DRS intelligence wing out of the political sphere before his re-election last April, in what observers said was preparation for his eventual departure after more than 15 years in power.
It was the culmination of a series of moves to restructure the DRS. This week, the presidency sacked several top generals working under Mediene.
Many of the changes to the DRS have been implemented by Army Chief of Staff Gaed Saleh, deputy defence minister and also a close ally of Bouteflika.
Restructuring transferred some DRS duties to the army, leaving the agency to focus on its essential task of collecting intelligence for the armed forces.
"Bouteflika wants a more civilian state with no DRS interference in politics," security analyst Anis Rahmani said. "Mediene's departure, I think, ends the DRS' time as a political tool."
Changes in the security apparatus are closely watched in Algeria, a partner in the Western campaign against armed groups in the region, since emerging in 2002 from more than a decade of its own conflict during which 200,000 people died.
Bouteflika was re-elected to a fourth term in April last year, but he has rarely been seen in public since recovering from a stroke in 2013, fuelling local media speculation over his ability to serve out his mandate, which ends in 2019.