The father of the toddler at the centre of a dramatic balcony rescue in Paris was out playing Pokemon Go during the nerve-wracking incident, according to reports.

Video footage of bystander Mamoudou Gassama rapidly scaling the outside of an apartment building on Sunday to rescue a four-year-old boy hanging from a fourth-floor balcony turned the 22-year-old Malian migrant into a national hero.

Video of Paris hero climbs four-storey building to rescue dangling child

As the clip went viral around the world, Gassama was invited to meet President Emmanuel Macron, and commended for his bravery with a promise of French citizenship and a job with the fire service.

However, many in France and beyond wondered where the boy’s parents were at the time of the incident, and how the child had ended up in such a precarious situation.

Prosecutors have revealed that the boy’s father left the toddler alone in the flat while he went out to shop for groceries at a nearby supermarket, but then lingered outside to play mobile game Pokemon Go.

Paris public prosecutor Francois Molins told news site 20 Minutes that the father, a man in his thirties, “got it into his head” to play the game after shopping and was “distraught” to learn what had taken place in his absence.

“I think he understands what he did, the terrible consequences it could have had,” Molin said.

The unidentified man was taken into custody on Sunday night, but has since been released. He will appear in court in September, facing two years in prison or a fine of up to €30,000 for child neglect.

The boy’s mother and a younger sibling were in Reunion, the French island in the Indian Ocean from which the family originally hails, at the time.

The unnamed woman told local TV channel Antenne Reunion that she had spoken to her husband and son on a video call half an hour before the incident.

The boy’s father was “distressed” by what had happened, she said, adding: “I’m not justifying what my husband did. My son was very lucky.”

As for Gassama, she said she would like to thank him for his quick-thinking bravery in person after her return to France today.