(CNN) -- For many girls in Afghanistan, the simple act of walking to school can be a life-threatening journey.
"You close the door behind you, and you enter a war zone," said Nushin Arbabzadah, an American-based author and scholar who was raised in Afghanistan.
There were at least 185 documented attacks on schools and hospitals in Afghanistan last year, according to the United Nations, and the majority of those attacks were attributed to armed groups opposed to educating females.
But "the walk from home to school is -- and has always been -- the most dangerous part," Arbabzadah said. "You are told to stay covered, keep your head down and walk quickly ... and stare at your toes."
The life of a schoolgirl in Afghanistan is a far cry from reading, writing and arithmetic. Some girls have been maimed by acid attacks. Others have had their drinking water poisoned or been targeted by bombers who think females should be forbidden from school -- as they were during the Taliban's rule.
"It is unfathomable that anyone would want to hurt them. But that is the reality," said Beth Murphy, a documentary filmmaker who recently traveled to Afghanistan to work on a feature film about girls' education.
Amid the violence, however, there is promise: In a country where just 6% of women 25 and older have received any formal education, millions of girls are at long last enrolling in school.
Ten years ago, fewer than a million Afghan children attended school, according to UNICEF. Today, more than 8.2 million children are going to schools like the one founded by Razia Jan, one of the Top 10 Heroes of 2012.
Jan and her team at the Zabuli Education Center are providing a free education to about 350 girls in rural Afghanistan.
"Most of the (local) men and women are illiterate," Jan said. "Most of our students are the first generation of girls to get educated."
The obstacles facing Afghan girls are both "Herculean and heartbreaking," Murphy said.
While she was filming at one school, there was an attack at another school nearby that killed 100 children.
That very same day, Murphy watched as young students embraced their opportunities to learn.
"To see these girls walking to school, delighted to be learning and spending time together in the classroom, writing their own names for the first time, reading their first words -- I felt hope for the future," Murphy said. "Not in a naive way but with the realization that if it's working here, it can work other places, too."
Although the violence against Afghan schoolgirls has dominated news headlines recently, reports from humanitarian groups like UNICEF, Oxfam and Save the Children say that a great deal of progress has been made.
"The overall education of girls in Afghanistan is a great success story," said Christine Roehrs, spokeswoman for Save the Children in Afghanistan. "Basically, you didn't have girls educated in 2001. And now we have 3 million girls in school."
Roehrs says there's still much work to be done, however, because there are approximately 4 million children in Afghanistan -- most of them girls -- who are not enrolled in school.
One major area of focus is the number of female teachers.
"In Afghan culture, parents don't consider it appropriate for girls to be educated by a man," Roehrs said. "There is a high dropout rate of young girls after the early grades because there are not enough female teachers. So the secret of getting and keeping girls in school is to get more female teachers."
Only 31% of all teachers in Afghanistan are female, Roehrs said, and a disproportionate amount of those women are in urban areas. The lack of infrastructure in rural areas also makes it even more difficult for girls to get an education there.
"There are 400 rural districts. In 200 of them, there are no female teachers or girls' schools," Roehrs said. "When I am talking to parents, they are favorable to girls' education. But the schools and teachers need to be close and safe."
To improve those rural numbers, Save the Children has implemented high school training programs so girls can become teachers right after graduation.
Another obstacle to girls' education is early marriage. The legal age for marriage is 16 in Afghanistan, but there have been many reports about girls being forced to marry well before that.
Murphy and her production crew met a 12-year-old student named Khudija whose marriage had been arranged by her brother, the oldest man in her family.
"The way kids in America might trade baseball cards on the playground, these boys traded their sisters: 'My sister will marry you; your sister will marry me,' " Murphy said. "Now it is Khudija's fiance and her fiance's father who dictate her life.
"Among the first decrees: No more school."
Knowing this is often the case, Jan goes to the homes of some of her young students and asks for permission to delay marriage. In some cases, she's had success. In others, she has seen students forced to withdraw from school.
"My heart breaks for them," Jan said. "Hopefully, things will change. Many fathers and grandfathers are proud to see their girls learning, so there are positive signs."
Still, across an already greatly divided country, old gender biases are hard to undo.
"You can have these huge kinds of variations and attitudes about education within the same family," Arbabzadah said. "I met a young female math teacher whose own family was split greatly on the topics of education. She told me her own cousin was very proud that he never sent his daughters to school. He thought it was the worst thing you could do."
In some cases, physical and emotional abuse keep girls out of the classroom. Many young women are accustomed to being hit and working as virtual slaves at home.
Jan recalls asking a young student a question and seeing the child put her hand in front of her face, afraid she would be struck.
"She and her sister had burn marks and scars on their bodies," said Jan, who stepped in to provide clothes and food for the children and threaten the girl's aunt with arrest.
According to the U.N., violence against women has been persistent in Afghanistan due to women's low status and the country's long exposure to hostilities and conflict. Gender discrimination can also be traced to a combination of factors, including poverty, local tradition and the effects of war.
But female students still have high aspirations. In a recent Oxfam survey (PDF), more than 70% of the girls interviewed said they want to continue their education.
"Once they enter the classroom, they are so involved being a student and trying to learn as much as they can," Jan said. "They want to learn. They want to get educated."
Advocates like Jan and Save the Children agree that if true change is to come in Afghanistan, it's crucial to educate this next generation.
Afghanistan has one the highest proportions of school-age children in the world: About one-fifth Afghans are between the ages of 7 and 12. Roehrs said that 57% of all Afghans are children.
"They form the future Afghanistan that some in the international community are afraid of and others might want to ignore," she said. "But it is paramount to look at these children and get the best education for them.
"These children are the Afghanistan we are looking at in 10 or 15 years."