The president stressed there is no contradiction between rewarding Mr Gassama for his act of bravery and working to prevent migrants from entering France illegally
French President Emmanuel Macron has lauded as a hero a migrant from Mali who scaled an apartment building in Paris to save a child dangling from a balcony.
Mr Macron rewarded the young man's bravery with an offer of French citizenship and a job as a firefighter.
"Bravo," the president said to 22-year-old Mamoudou Gassama during a meeting in a gilded room of the Elysee Palace, where Mr Gassama also received a gold medal from the French state for "courage and devotion".
Mr Gassama climbed five storeys up the apartment building, moving from balcony to balcony, and whisked a four-year-old boy to safety on Saturday night as a crowd below screamed.
His actions went viral on social media, where he was dubbed "Spiderman".
Mr Gassama said he has authorisation to stay legally in Italy, which is where he landed in Europe in 2014 after 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 a 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," Mr Gassama told Mr Macron.
He said he did not 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."
Mr Gassama said he trembled with fear only after he had reached the boy, got 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."
Mr Macron offered to begin the naturalisation process to make Mr Gassama a French citizen, and said: "Because this is an exceptional act ... we are obviously, today, going to regularise all your papers."
The president is behind a bill toughening French immigration law, and he stressed there is no contradiction between rewarding Mr 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 Mr 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 at the Elysee.
Mr Gassama told Mr Macron he was arrested and beaten during his long, rough stay in Libya "but I wasn't discouraged".
The French president said Mr Gassama's actions made him deserving of special treatment.
Working as a firefighter corresponds with his skills, said Mr 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 Malian, 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 shop where he worked.