An Egyptian military court made a mistake by sentencing a four-year-old boy to life in prison for murder last week, the military has acknowledged.
Spokesman Col Mohammed Samir said the court should have sentenced a 16-year-old with a similar name instead.
Ahmed Mansour Qurani Ali was convicted along with 115 others in connection with riots by Muslim Brotherhood supporters in Fayoum province in 2014.
His lawyer had submitted documents proving that he was one at the time.
In a post on Facebook (in Arabic), Col Samir said Ahmed Mansour Qurani Sharara, 16, should have been sentenced and not Ahmed Mansour Qurani Ali.
It not clear what will now happen to the four year old.
The child's lawyer said his name had been added to the list of suspects by mistake - and that court officials had not passed his birth certificate to the judge to prove his age at the time of the offence.
He was subsequently convicted of four counts of murder, eight counts of attempted murder and vandalising government property.
Egypt's judicial system has come under repeated criticism since the military overthrew President Mohammed Morsi in 2013, following mass protests.
Since then, more than 1,000 people have been killed and 40,000 are believed to have been jailed in a sweeping crackdown on dissent.
Most of them have been supporters of the Muslim Brotherhood, but secular activists have also been prosecuted for breaking an anti-protest law.
In 2014, the UN warned that Egypt had "a judicial system where international fair trial guarantees appear to be increasingly trampled upon" after more than 1,200 people were sentenced to death in two mass trials "rife with procedural irregularities".