Video shows Gassama risking his life on Sunday as he climbed up the balconies to rescue the four-year-old who is clinging to a railing and glancing at the ground below, while horrified onlookers watched.

Paris - The father of the four-year-old boy rescued from a fourth-floor balcony in Paris left his son alone to go shopping and returned home later than planned because he was playing Pokemon Go on his smartphone.

The boy's father was arrested and told police he had been late because he had being playing the enhanced reality game on his phone.

"His behaviour constitutes an offence, failing to honour parental responsibilities, which carries a possible sentence of two years in jail," François Molins, the Paris prosecutor, said.

According to reports, the father has been released pending trial, and the boy’s mother had not been in Paris at the time of the episode.

“He is devastated because he realises what he did, and the tragic consequences that it could have led to,” Mr. Molins said.

WATCH: 'Spiderman' scales four storeys to save child on a ledge

Meanwhile French President Emmanuel Macron on Monday offered citizenship to Mamoudou Gassama, an illegal immigrant from Mali, who scaled the facade of a Paris apartment block to save the boy who was about to fall from a fourth-floor balcony.

Video shows Gassama, 22, risking his life on Sunday as he climbed up the balconies to rescue the four-year-old who is clinging to a railing and glancing at the ground below, while horrified onlookers watched.

The video went viral and Gassama, who has been nicknamed "Spider-Man" for reaching the boy in the nick of time, was swiftly granted a meeting at the Elysee Palace.

"I did it because it was a child," French newspaper Le Parisien quoted Gassama as saying. "I climbed .... Thank God I saved him."

Read more: Malian 'Spiderman' who saved child to get French citizenship

Macron congratulated Gassama for "an exceptional act" and said France would give him a job in the emergency services.

"We'll obviously be setting all your papers straight and if you wish it, we will start the process of naturalization so that you can become French," he added.

Ministers said the citizenship process would be sped up, although Gassama can't legally be granted it right away.

As elsewhere in Europe, immigration from Africa and the Middle East has fixated French public opinion in the last few years, fueling the rise of far-right parties such as the National Front.

Macron, who had been criticised by left-wing voters for taking a tougher stance on immigration since his election, may also have sought to send a message to Socialist voters by signalling a more welcoming attitude to a deserving migrant.

Gassama told Macron he tried to cross the Mediterranean in March 2014 to reach Italy, but was caught by police.

Europe has faced a migrant crisis since 2015 following wars in Libya and Syria and more than 1 million people from Africa and the Middle East have tried to reach the continent via Turkey or by sea.

Macron's government has said it wants to be both firm and fair on immigration but it took a tougher stance lately, with parliament approving a bill that tightens asylum rules.

"What you have done corresponds with what firefighters do; if this fits your wishes, you could join the firefighters' corps so that you can do (such acts) on a daily basis," he said.

Adam Thiam, a Malian analyst and former presidential advisor told Reuters that Gassama's act had been praised in his home country.

"There is great pride here in Mali," Thiam said. "But while (Gassama) gets the honours, there are ... Malian citizens under the threat of being expelled by the French government."

Gassama told Paris Mayor Anne Hidalgo by phone on Sunday he arrived from Mali a few months ago and wished to stay in France.

"I replied that his heroic gesture was an example for all citizens and that the City of Paris will obviously be keen to support him in his efforts to settle in France," Hidalgo said.

The boy's father was arrested and told police he had left his son alone to go shopping and returned home later than planned because he was playing Pokemon Go, an enhanced reality game, on his smartphone.

Gassama is being offered a spell of community service work at the Paris emergency services. An official website says the work pays about 480 euros ($558) a month for a fixed 11-month period.

Reuters and IOL