As many as half a million Syrian refugee children in Turkey are not attending school - leaving them open to exploitation in sweatshops and other forms of abuse, aid organisations and teachers in the country have warned.
But the number in education is now rising steadily as the Turkish authorities and other agencies make efforts to save what has been called a "lost generation".
Turkey hosts more refugees than any other country - nearly 3 million - and the vast majority of those are Syrian, including more than 700,000 school-age children. At least two-thirds of them receive no formal education.
One who missed three years of school is a girl called Lima, originally from the Syrian capital, Damascus. She started work in a textile factory in Turkey's largest city, Istanbul, when she was only nine, working 14 hours a day packaging socks. She earned only 60 Turkish lira ($20, £14) a week.
Now Lima is studying at a school for Syrian refugee children in Istanbul called Shamuna (Our Syria). It's one of an expanding network of special Arabic-language schools - officially known as temporary education centres - for refugees, some run by the Turkish authorities, others, like Shamuna, by independent Syrian associations.
It educates 1,150 pupils, boys and girls of primary and secondary age, on six floors of a former office building in an Istanbul suburb. There is no playground and the entrance is simply a corridor off the street between two shops.
Shamuna was founded four years ago by Shaza Barakat, the former head of a Damascus education institute, shortly after her 16-year-old son Omar was killed fighting in Syria.
Dr Barakat says he returned there from Turkey after becoming depressed because he couldn't find a suitable school in Istanbul at which to continue his studies and several of his friends did the same.
She says: "If we could have opened a school straight away, perhaps we could have given them a chance to be educated and plan for their future, but unfortunately now it is too late."
She says she got no help from any official body when she opened the school. She had to find the building, beg money for rent from exiled Syrian businessmen and persuade Syrian refugee teachers to work as unpaid volunteers.
She even had to search for a curriculum and an authority to endorse the leaving qualification. For the first two years her pupils, and those from other Syrian schools in Turkey, received Libyan school certificates.
Now such schools are inspected and approved by the Turkish Ministry of Education and use a version of the Syrian curriculum, which has partisan references to President Assad and the ruling Ba'ath Party removed.
Unicef, the United Nations children's agency, now pays the volunteer teachers a $300 (£210) monthly "incentive".
The number of Syrian pupils in school in Turkey rose from 225,000 in July 2015 to 330,000 this February.
But there are still not enough of the schools and, at those run by independent groups, parents are often expected to make a contribution to costs.
Since 2014, Syrian children have also been allowed to use ordinary Turkish public schools, which are free, but only about a third of the youngsters attend them.
One big barrier is the Turkish language and another the lack of extra catch-up provision in many of the schools.
An international charity called Small Projects Istanbul runs a refugee support centre in a suburb of the city where volunteers help Syrian children with their Turkish and encourage them to attend school.
One who's now studying in a Turkish school after a year in a sewing factory is 15-year-old Hassan. Though some Syrian children say they feel isolated and even suffer racist bullying in Turkish schools, Hassan has had the opposite experience.
"All my teachers love me and the other students consider me to be one of them," he says.
Small Projects Istanbul is now trying to raise money to enable other Syrian youngsters - like 16-year-old Hussain - to return to school from work by subsiding their families. He dreamed of studying to become a vet or an engineer, but now works 12 hours a day, six days a week in a textile workshop.
He says: "I work in a basement. I just go to work in the morning, I don't see the sun and I go back after sunset. It's very dark here in this country."
Unicef hopes that all Syrian children in Turkey will be studying by the end of 2017, but that will depend partly on a huge increase in school provision.
Education is intended to be one of the main focuses of a multi-billion-euro aid package for refugees, which the European Union is offering Turkey in return for an agreement allowing migrants to be sent back from Europe.
But the deal has faced many obstacles and it is still unclear whether it will be fully implemented.
Tim Whewell's report is part one of the five-part Destination Europe series broadcast weekly as part of The Compass series on the BBC World Service from 30 June
You can listen to the programme on iPlayer.