In some areas, if children were caught going to school their fathers would be taken to the police station, and girls particularly would be harassed and slapped.
Lots of schools can now open again because there's new leadership in Afghanistan since the Taleban were defeated. Many schools have been helped to re-open by American troops, who flew in thousands of books for the pupils.
However, it's not all good news. More than two million children still can't go to school because about half of all Afghanistan's schools were destroyed under the Taleban in all the fighting.
Nine-year-old Maryam, who was not allowed to go to school under the Taleban, said: "I'm so excited."