Algerian President Abdelmadjid Tebbounevisited the Polisario Front leader Brahim Ghali at a military hospital in Algiers, following his return to Algeria after six weeks of medical treatment in Spain.
Tebboune described the visit as "his duty" and reaffirmed his support for Ghali's cause.
The Algerian president also thanked Spain for welcoming Ghali and for the "delicate" care he had received.
Algeria is the main supporter of the Polisario Front, which has for decades fought Morocco for the independence of Western Sahara, a desert region bigger than Britain which was a Spanish colony until 1975.
Considered a war criminal by Morocco, Ghali has headed the Polisario Front since 2016 and is president of the Sahrawi Democratic Arab Republic, a self-declared state in an almost-landlocked area flanking Mauritania's border.
Rabat has offered Western Sahara autonomy but insists that the territory, which is rich in phosphates and offshore fishing, is part of the Moroccan kingdom.
Morocco and Brazil go head to head in Tangier
Morocco's squad to play Brazil 25 years after last face-off
Morocco: Eight charged in sex abuse case against French tycoon
Morocco joins Spanish and Portuguese bid to host 2030 FIFA world cup
Go to video
France: 2 journalists sentenced for blackmail against the King of Morocco
Morocco says joining Spain-Portugal 2030 World Cup bid