Heraclius II (Greek: Ηρακλειος Β')was Roman Emperor and Caliph of Islam from 795 to 859. He is known for having been the longest-ruling of all emperors to date, having reigned for 64 years in an era where the average life expectancy was barely 40, and for his efforts to avoid the total collapse of Roman power. He was raised to the imperial dignity amidst the troubles following the assassination of his half-brother, Constantine VI, and spent the first year of his reign hunting down the assassins and bringing the plotters, led by his stepmother Irene, to justice.
Rome was on the brink of collapse after the losses endured under his predecessor. To try and strengthen the foundations, Heraclius abandoned northern Mesopotamia and established a new, more defensible frontier along the Euphrates River. He gifted Caria to the Bulgars in order to temporarily quench their thirst for expansion, and he demolished many ancient monuments in the cities in order to strengthen the border fortifications. For a long time his efforts seemed to be working, but by the end of his reign his enemies were once more on the advance.
Notably, Heraclius managed to end the iconoclastic controversy as he tried to promote unity amongst the Roman people, and religious icons since then have been tolerated but heavily restricted. It's thought that his acts of reconciliation were instrumental in finalising the conversion of Asia Minor, and later Greece and the West, to Islam.
Heraclius died in 859 at the age of 90. He was succeeded by his grandson, Michael I, who would be the last of the Isaurian emperors.