Now the 13-year-old, along with hundreds of others maimed by such bombs every year, is learning to use a prosthetic in a society where the disabled have traditionally been shunned and forced to stay at home.
Nearly a year on, he is set to receive a new leg at the Pakistan Institute of Prosthetic and Orthotic Sciences in Peshawar (PIPOS) where thousands have been treated, a lifeline for many in the country with some of the highest IED death rates in the world. Ali remembers the day he lost his limbs vividly.
It's not clear who was behind the blast that tore into Ali at the school gate as he was coming back from lunch.
"I had been walking along with some classmates but I was walking faster and left them behind," he said.
Also Read
He was rushed by his father to a field hospital, then taken on an arduous 12-hour journey to Peshawar - by car, van and bus, bleeding all the way - where medics saved his life.
"There is stigma around disability and a fear of becoming a burden on one's family, especially for young men who are supposed to take responsibility to provide for their family," said Shaista Aziz, a spokeswoman for Doctors Without Borders, which runs several trauma centres in Pakistan's northwest.
While the use of landmines planted by armies has fallen globally since the 1990s, the number of civilians hit by improvised explosive devices has skyrocketed, according to Action on Armed Violence. The British charity recorded a 70 per cent global rise in civilians killed or maimed in such attacks between 2011 and 2013.
Headquartered in Peshawar where it was founded in 1981 to deal with the wounded during the Soviet invasion of Afghanistan, PIPOS clinics treat around 10,000 patients a year - many of whom are victims of suicide blasts, IEDs and landmines.