Alex Batty, 17, went missing in 2017 and British officials are expected to bring him back to the UK later.
A British teenager missing in France for six years messaged his grandmother: “I love you, I want to come home” after he was picked up by a driver.
Alex Batty vanished in 2017 on a holiday in Spain with his mother and grandfather.
The pair do not have parental guardianship of the 17-year-old and remain wanted over his disappearance.
Alex is at a young person’s centre in Toulouse and may return to the UK later with police and consular officials.
A police source earlier told BBC News the boy had been taken to a police station by the concerned motorist who had spotted him on a road in the foothills of the Pyrenees early on Wednesday morning.
“He explained that he had been walking for four days, that he set off from a place in the mountains, though he didn’t say where,” delivery driver Fabien Accidini said.
“I typed his name into the internet and saw that he was being looked for,” he said.
Mr Accidini told local media the teenager’s plan had been to find a big city with an embassy to ask for assistance. Instead, Mr Accidini contacted French authorities for help.
Alex used Mr Accidini’s Facebook account to contact his grandmother back in the UK.
He wrote: “Hello Grandma, it’s me Alex. I’m in France Toulouse. I really hope that you receive this message. I love you, I want to come home.”
The BBC understands that Alex’s grandmother, Susan Caruana, who is also his legal guardian, is too frail to travel to Toulouse, but she told The Sun newspaper she had been in touch with him.
“I am so happy. I have spoken to him and he is well,” she said. “It is such a shock.”
The BBC also understands that the French prosecutor’s office in Toulouse have officially handed the case over to British police and it is no longer under French jurisdiction. A team of British police officers and consular staff are expected to pick Alex up and bring him back to the UK as early as Friday.
It is understood that Alex had been living in the remote Pyrenean valleys, travelling about from place to place in a kind of itinerant commune.
The area in the foothills of the Pyrenees is known for attracting people in search of alternative lifestyles.
Alex, from Oldham in Greater Manchester, won’t say where his mother is or exactly where he had been living in the Pyrenees, the prosecutor’s office told the BBC.
Ms Caruana told the BBC in 2018 that she believed Alex’s mother Melanie Batty and grandfather David Batty had taken him to live with a spiritual community in Morocco.
She said at the time they were seeking an alternative lifestyle and did not want Alex to go to school.
Melanie and David Batty left Greater Manchester with Alex for a pre-agreed week-long holiday to Marbella in Spain on 30 September 2017.
He was last seen at the Port of Malaga on 8 October that year, the day they were expected to return to the UK.
British police were contacted via the UK embassy in Paris.
Greater Manchester Police confirmed it was in touch with French authorities to put “safeguarding measures in place”.
“This is a complex and long-running investigation, and we need to make further enquiries as well as putting appropriate safeguarding measures in place,” a spokesperson said.
In a statement, the Foreign, Commonwealth and Development Office (FCDO) said: “We are supporting a British national in France and are in contact with local authorities.”
Additional reporting by Chris Bockman in Toulouse