The French invaded Algeria during the 1800s, only 30 years after the Barbary wars where US, Sweden and Italy teamed up to put the NAFRIs in their place. The French instead permanently occupied Algeria and tried to civilize the country. Pied Noire (French settlers) lived their for hundreds of years in peace.
The CIA supported the FLN in the 1940s in an attempt to "turn them away from communism" and they instead just became Islamists until the Algerian civil war where the Western backed "democratic" government overcame the FIS (Front of Islamic Salvation) in a brutal civil war, which killed more than the Algerian war of independence. Remember decolonisation was an official American policy.
The French generals of the 1950s predicted a civil war in developing Algeria and tried to stop it with a coup, it failed, along with it went the Pied Noire who were massacred to the point where they started bombing mainland France to force them back into Algeria (OAS). As it failed the pro-French minority (Harkis) along with the Pied Noire (French settlers) fled to France. The democratic American backed front was unable to deal with the Islamist wing of the FLN and former freedom fighters like Mohamed Boudiaf were murdered on live TV.
The country dissolved into chaos and civil war with the Islamist FIS splitting into two fronts, an explicitly Islamist group called GIA, which massacred random villages in Algeria until the government received their demands (Dont look up GIA village massacres) and the FIS loyalists who were also beat by the ANP. GIA bombed France numerous times even after it left Algeria just from pure Islamist hatred of France.
Overtime a USSR backed strongman called Liamine Zéroual was put into place who cleaned the country up and tried to reconciliate France to receive aid. Gradually Algerian foreign policy included French oversight as they had clearly failed to rule themselves and so Algeria was left as an undemocratic state in the French neo-Empire.