"The explosion occurred when the army was digging for a homemade bomb when it went off and killed two soldiers," according to the statement.
It stressed the army "will continue unabated efforts, whatever the sacrifices, to pursue the remnants of these criminals and eliminate them wherever they are found throughout the entire national territory."
President Abdelmadjid Tebboune, also defense minister and commander-in-chief of the army, expressed his condolences to the families of the soldiers.
The Algerian army frequently announces the discovery and destruction of homemade bombs.
The security situation in Algeria has remarkably improved in the last decade, but clashes between security forces and groups designated as "terrorists" are still occasionally reported.