Ahmed Ben Bella helped lead Algeria's fight for independence from France and after victory became its first president, a figure who symbolized the romance of the national liberation struggle before the harsh reality of running a country intruded.
He died on Thursday morning in the Algerian capital, aged 96, after an illness, the state-run news agency reported.
The son of peasant farmers who grew up near Algeria's border with Morocco, Ben Bella was a decorated soldier in the French army during World War Two, and then joined Algeria's outlawed national independence movement, spending several years in French prisons.
When France relinquished control of Algeria in 1962, Ben Bella became president. In orders issued in the heady days after independence, he helped shape the young country by nationalizing industry and becoming a champion of Third World anti-colonialism.
But he lacked the political weight to build the young country and fend off challenges to his power. After three years he was pushed out by Houari Boumediene, from the independence movement's military wing, who took over as head of state.
That event established a pattern, still in place half a century later, of the military exerting strong influence over Algeria's political life.
Ben Bella subsequently spent years in jail and exile, only finally settling back in Algeria after Abdelaziz Bouteflika, the serving president, was elected in 1999.
Independence fight
Called up into the French military after school, Ben Bella played for the top-flight Olympique de Marseille soccer club. During World War Two he fought with French forces against the Germans and Italians.
He distinguished himself in the battle of Monte Cassino, in Italy, in 1944, and was decorated personally by General Charles de Gaulle, the man who later, as his country's president, would give up French rule over Algeria.
When he returned home after the war, Ben Bella was swept up in a wave of anti-French feeling following a massacre, by French forces, of protesters on 8 May 1945.
He joined the underground independence movement which at the time was building its ranks and taking part in activities such as post office robberies to gain funds.
He was arrested in 1950 but escaped and fled to Cairo, where he established ties with Gamal Abdel Nasser, who would later become Egyptian president and one of independent Algeria's closest allies.
Ben Bella was arrested again in 1956 when the Moroccan aircraft carrying him and fellow leaders of the independence movement was intercepted by the French military.
He was freed soon after France declared a ceasefire, ending a war for independence that killed hundreds of thousands of people.
Twenty years later, recalling the moment Algeria became an independent state, Ben Bella said: "It was a big moment for which a high price was paid, too high."
Populist
As president, Ben Bella was a master of the eye-catching, populist gesture. He banned shoe-shine boys, arguing the practice was a demeaning relic of colonial rule.
One of his first acts was to travel to Washington, D.C. for a meeting with U.S. President John F. Kennedy. Ben Bella was feted in the White House as a hero of the anti-colonial struggle.
Straight afterwards – in an assertion of his country's independent spirit – he flew on to Washington's arch-enemy Cuba. He embraced Fidel Castro and, according to a press report at the time, praised the "extraordinary progress" of the Cuban revolution.
But at home, Ben Bella was struggling to build a state almost from scratch. Algeria was left with almost no teachers or doctors after the French departed. The former colonial rulers, according to one Algerian archaeologist, even took the maps of the sewage system away with them.
Ben Bella tarnished his democratic credentials, some of his contemporaries said, by making sure his opponents were excluded from an assembly that was drawing up the country's new constitution.
The military, hugely powerful after winning the war with France, took over. Writing later about how he was ousted by Boumediene, Ben Bella said: "I knew what his intentions were and I could have had him stopped 20 times."
Ben Bella returned briefly from exile in the late 1980s when mass protests led to a short-lived relaxation of political controls. He set up a party called the Movement for Democracy in Algeria and made an abortive run for the presidency.
He went back into exile in Switzerland for most of the 1990s, when Algeria was convulsed by a conflict between government forces and Islamist militants which killed an estimated 200,000 people.
Ben Bella's death coincides with the 50th anniversary of Algerian independence. For many Algerians the date is bitter-sweet because they feel the hopes and aspirations that accompanied the country's birth have not been matched by events since then.