Media playback is unsupported on your device Media caption Latest figures show Pakistan has the second highest number of children out of school in the world.

When a Taliban gunman shot Malala Yousafzai last October, the bullet travelled beyond her native Swat Valley in northern Pakistan.

It echoed around the globe, and ricocheted through another conservative community in the north - with surprising results.

First there was fear, says local aid worker, Qurratul Ain Sheikh, sitting in a school courtyard perched on a hilltop. "After the Malala issue so many parents, especially mothers, did not allow their daughters to come to school," she said. "They were so afraid."

That anxiety kept the girls' primary school empty for a month.

But then aid workers, and teachers, began to fight back. They lobbied parents about the need to educate their daughters. They began holding meetings and putting pamphlets through doors. And the Malala effect kicked in - parents refused to be cowed, and sent their daughters back to school.

My Mum saw what happened on TV and it made her think - she decided her girls should also be in school and get a good education Tasleem, 10

"There was a positive change, especially in the mothers," says Qurratul Ain. "They allow their daughters to go to school and work like Malala, and raise their voices for their rights, especially child rights."

And there was a bonus - enrolment went up, with an extra 30 girls coming to school, swelling the numbers to almost 300.

This school has not been targeted by the Taliban, nor have others in the area. But we have decided not to identify the location as a precaution.

'Follow her example'

Behind high white-washed walls, the school day begins with assembly in the yard. The pupils line up neatly, to sing the national anthem, clad in white headscarves, and pale blue tunics.

Then they file into colourful classrooms, where posters of flowers and insects line the walls. Younger pupils sit in clusters on woven mats on the floor.

A slight 10-year-old called Tasleem is one of the new arrivals. She's polite, and chatty, and wants to be a policewoman. Tasleem says her mother was angered by the sight of Malala being rushed away after the attack, fighting for her life.

"Before Malala was shot we didn't think we should go to school," she told me. "My Mum saw what happened on TV. That made her think. After this she decided her girls should also be in school and should get a good education. "

Image caption Enrolment went up in this primary school in the aftermath of Malala's shooting

Tasleem lowers her eyes when she recalls how the campaigning teenager was shown no mercy. "She was attacked so brutally," she says, "and she had done nothing wrong. The men who shot her probably didn't like that she was helping girls to be educated. We should all follow her example," she says firmly.

Sitting alongside her is Nadia, a studious 10-year old who dreams of being a doctor. Like Tasleem, she is the first girl in her family to go to school.

"I used to tell my father I want to go to school," she says. "He always said no. But when my parents heard about Malala's story they said you should go to school. When I started I didn't know anything. Then my teacher explained things to me. I learnt how to read and write, and a lot of other things."

Malala has changed the equation for these girls, in this mountain hamlet. But many children in Pakistan never see the inside of a classroom.

The country has an army of child labourers born into poverty, and often into debt

Lost generation

The country has the second highest number of children out of school in the world, and the figures are getting worse.

Around 5.4 million children of primary school age don't get an education, according to the latest statistics from the United Nations Educational, Scientific and Cultural Organization (Unesco). There are an additional seven million adolescents out of school. And spending on education has been decreasing in recent years.

Pakistan invests seven times more in the military than in primary schooling. What these numbers add up to is a lost generation.

Image caption Children as young as four spend long hours shaping mud into mounds, for use in bricks

Many children in Pakistan only learn lessons in hardship. The country has an army of child labourers born into poverty, and often into debt. A leading Children's rights group here, SPARC, estimates they could number as many as 12 million.

At a kiln outside the city of Hyderabad, in the southern province of Sindh, the BBC filmed some of them at work. Children as young as four and five squat for hours, shaping mud into mounds to be baked into bricks. They are caked in dust, and scorched by the sun. Everyone has to pull their weight - even scrawny boys pushed wheelbarrows around the site.

If we earn, we eat - otherwise we go hungry Jeeni, 10

Ten-year-old Jeeni toils here with the rest of her family - nine siblings, mother and father. Like many at the kilns, they are members of Pakistan's Hindu minority.

They earn just 300 Pakistani rupees ( £2; $3) a day, which isn't enough for one decent meal. And to get that, they have to produce 1,000 bricks, which takes up to 15 hours.

Under her faded pink headscarf, Jeeni has a troubled and weary look. Her young shoulders are carrying an adult burden and these days it's heavier than ever.

"If we earn, we eat," she says, "otherwise we go hungry. My big brother was hurt. He can't help our father making bricks. He can't make any money. So now it's only us - younger ones - who are working." As she speaks, her voice breaks and she begins to cry.

Jeeni's father, Genu, who is hollow-cheeked, knows his children are being robbed of their future, but says he is too poor to stop it.

"I understand the importance of education," he says, sitting in the dirt. "I had some schooling myself. If I die what will happen to them? They are illiterate. Anybody will be able to trick them. But I can't manage to send them to school."

Jeeni went to school once - for a day - but transport was costly.

She longs to return, but that dream may be buried, brick by brick.