PARIS -- A young man from Mali is being praised as a hero after he scaled an apartment building to save a child dangling from a balcony. President Emmanuel Macron on Monday rewarded the young man's bravery with an offer of French citizenship and a job as a firefighter.

"Bravo," Macron said to 22-year-old Mamoudou Gassama during a meeting in a gilded room of the presidential Elysee Palace where Gassama also received a gold medal from the French state for "courage and devotion."

Gassama climbed five stories up the apartment building, moving from balcony to balcony, and whisked a 4-year-old boy to safety on Saturday night as a crowd below screamed. His actions went viral on social media, where he was dubbed "Spider-Man."

Get Breaking News Delivered to Your Inbox

Gassama said he has authorization to stay legally in Italy, which is where he landed in Europe in 2014 after a more than a year in Libya and a trip across the Mediterranean Sea. He came to France in September to join his older brother, who has lived in France for decades.

Dressed in tattered blue jeans and white shirt, the young man recounted for the president what took place after he and some friends saw a young child hanging from a fifth-floor balcony.

"I ran. I crossed the street to save him," Gassama told Macron. He said he didn't think twice. "When I started to climb, it gave me courage to keep climbing."

God "helped me," too, he said. "Thank God I saved him."

French President Emmanuel Macron speaks with Mamoudou Gassama at the presidential Elysee Palace in Paris, May 28, 2018. THIBAULT CAMUS/AFP/Getty

Gassama said he trembled with fear only after he had reached the boy, gotten him safely back over the balcony railing and taken him inside the apartment.

The father of the child was detained overnight for alleged parental neglect, and is to appear in court in September. He left the child alone while he shopped, then lingered to play Pokemon Go, Prosecutor Francois Molins told BFM-TV. The whereabouts of the child's mother were unclear.

"You saved a child. Without you, no one knows what would have become of him," the president said. "You need courage and the capability to do that."

Macron offered to begin the naturalization process to make Gassama a French citizen and said, "Because this is an exceptional act ... we are obviously, today, going to regularize all your papers."

Quel courage .. bravo à ce jeune du 18eme pour cet acte héroïque 👏🏼 Posted by Habib Bibou on Saturday, May 26, 2018

Macron is behind a bill toughening French immigration law, and he stressed there is no contradiction between rewarding Gassama for his act of bravery and working to prevent migrants from entering France illegally by stopping the stream of arrivals at its source.

"An exceptional act does not make policy," he told reporters later, vowing to maintain a policy that is "exigent, respectful of our principles" on asylum and "rigorous" regarding the migratory flux.

The special treatment for Gassama comes as authorities prepare to evacuate some 2,400 migrants from makeshift encampments in the French capital. The forced closure of the encampments is the subject of a heated debate between the Paris mayor, who wants to ensure the uprooted will be sheltered, and Interior Minister Gerard Collomb, who was present Monday at the Elysee.

Gassama told Macron he was arrested and beaten during his long rough stay in Libya, "but I wasn't discouraged."

The French president said Gassama's actions made him deserving of special treatment. Working as a firefighter corresponds with his skills, said Macron, who opened the door for him to do just that.

"You have become an example because millions have seen you" on social media, the president said.

Another Malien, Lassana Bathily, was given French citizenship in January 2015, shortly after he saved lives by hiding people in a freezer and alerting police during a terror attack on a Jewish grocery where he worked.