Thousands of people who fled ongoing violence said their children's schooling was a major factor in their decision to return.
Education has taken a battering during years of violence and unrest in Libya.
An estimated 300,000 children need education in emergencies support, according to UNICEF. And over 64,000 of the most vulnerable young people have received psychosocial help this year to deal with trauma.
But amidst the gloom of civil war, there are some glimmers of hope.
More than 370,000 displaced Libyans returned to their homes in May and June - and they gave education as a major reason, alongside access to health services and security. In fact, a third of returnees who were surveyed listed education as the number one cause for going back.
For many displaced children who have recently returned home with their families, school offers a safe space. One of them is Amina Zintani, a 12-year-old student who had to leave Ubari to go to school far from home.
Now she's back at Alqurania school, which was renovated by the government in a programme implemented by the UN Development Programme.
“I didn’t expect to return to my original school in Ubari," said Amina. "I am glad to see the classrooms and the courtyard in in great shape after the renovation.
“It feels great being with my friends again. The people and this place mean a lot to me.”
Of 97 areas surveyed by the International Organization for Migration, 90 of them said 80% to 100% of public schools were operating normally.
Libya's education minister Othman Abdeljalil also pointed to the success of the secondary school certificate exams this summer. He said reforms to exams will be followed by other changes - including filling the gap in some school subjects and raising the efficiency of teachers.
Back in March, Abdeljalil said security unrest, lack of funding and the absence of opportunities for teacher training were hindering the progress of education in Libya.
“Some schools have stopped operating altogether and others are in a very bad condition,” he said at the time. “In some areas, the teachers are incapable of maintaining their work because of the violence.”
Libya's state school system has about 1.5 million students but many schools have been destroyed or closed down, due to lack of teachers or security fears.
“A rising pitch of violence in those areas makes continuing the educational process impossible," said Abdeljalil earlier this year. "Going to work for the teachers and attending classes for the students is a heroic mission.”
The education ministry’s $5.6 billion budget is a fraction of the amount needed to upgrade the country’s system. Abdeljalil has said it needs to be at least three times as much to keep schools functioning and give teachers the training they need.
Libya is a country split among military and political factions.
The effects of conflict on students has been huge - with many suffering psychological disorders and traumas. The education ministry set up an administration for guidance and psychological support.
UNICEF said 64,000 girls and boys received psychosocial support through community and school-based child friendly spaces in the first half of 2018.
The agency is working to scale up its programme of psychosocial services and violence prevention in schools to build the resilience and wellbeing of the most vulnerable children.
Last month UNICEF said 489 schools were affected by the violence and conflict in Libya.
Geert Cappelaere, UNICEF Regional Director for the Middle East and North Africa, said 26,000 students were forced to change their schools after they were closed by violence in the eastern and southwestern parts of the country.
Theirworld and others have been campaigning for schools to be safe places for children to learn and be with their peers.
80 countries have now signed up to the Safe Schools Declaration - a commitment to protect education and stop military use of schools.
But only two of the world’s most powerful countries - the permanent members of the United Nations Security Council - have done so. France and the United Kingdom have shown the way and we’re calling on China, Russia and the United States to follow their lead.
Libya has not signed the declaration.
The effects of years of war are felt in many different ways in Libya's schools.
Many operate two or more shifts per day to increase the number of students who can be taught at each school building. But other factors are hitting educational standards, including poor hygiene.
More than half of schools have insufficient and poor-quality drinking water and sanitation facilities - and over two-thirds have limited drinking water, according to a nationwide study.
Despite health ministry standards of one toilet per 25 students, the assessment also revealed the average number of students to a functioning toilet is 71. Some schools were found to have no functioning toilets at all.
For girls in particular, a lack of good water and sanitation facilities has been shown to have a detrimental effect on their education.
“The situation of water in Libya, especially its schools, is a critical issue,” said Abdel-Rahman Ghandour, UNICEF's Special Representative in Libya.
“Too many students are missing out on vital education due to the current lack of investment. Urgent measures are needed to address this shortage.”