PARIS — The president of Algeria resigned Tuesday night under pressure from the army following weeks of mass protests, closing out the reign of North Africa’s longest-serving leader but not ending a political impasse in a country where the street is demanding revolutionary change.

The state news agency said that President Abdelaziz Bouteflika, who is ailing and paralyzed and has not spoken to his countrymen in seven years, had submitted his resignation.

His departure followed quickly after a statement from the chief of staff of Algeria’s army, the traditional arbiter of political life in the country, calling for an “immediate” declaration from the constitutional council that Mr. Bouteflika was unfit for office.

Mr. Bouteflika, who was president for 20 years, had sought to prolong his rule, pushed by family members and others in Algeria’s ruling elite who sought “the preservation of their narrow personal interests,” the army chief of staff, Gen. Ahmed Gaid Salah, said Tuesday night.