Hisham Ashmawi was found guilty of involvement in several high-profile attacks, including one in western Egypt in 2014 that killed 22 security personnel, an army spokesman said.
He was also convicted of being behind a 2013 attempt to assassinate then Interior Minister Mohammed Ibrahim.
Ashmawi was captured in eastern Libya last year by Khalifa Haftar’s forces.
The renegade commander of the self-styled Libyan National Army (LNA), which has close relations with Egypt’s government, handed Ashmawi over for trial this May.
Ashmawi, also known as Abu Umar al-Muhajir, once served in the Egyptian army’s special operations force but was dismissed over his religious views.
The army said he later became a senior figure in the Sinai-based jihadist group Ansar Beit al-Maqdis, but that he left before it pledged allegiance to the Islamic State group in 2014.
Ashmawi subsequently moved with a number of followers to Egypt’s Western Desert, and then crossed the border into eastern Libya, it added.
In 2015, Ashmawi allegedly established an al-Qaeda-aligned group called al-Mourabitoun, which was blamed for an attack two years later that killed 28 Christian pilgrims travelling to a monastery.