After ISIS took control of Mosul in mid-2014, the extremist militant group closed the city’s 990 schools, altered the curriculum to support its ideology, and then reopened the schools to push dogma over academic learning.

Suddenly, education in Iraq’s second-largest city had been devastated from kindergarten through college.

East Mosul was liberated from ISIS in December, and the battle to liberate West Mosul has just begun, by Iraqi forces backed by U.S. airpower.

Efforts to stabilize Mosul afterward will need to include a plan to rebuild education in addition to restoring the city’s damaged infrastructure.

During my recent visit to Iraq, many officials expressed this view, including an Iraqi general leading the part of the battle to retake West Mosul who said he believes an education strategy is as important as economic, political and security strategies for bringing stability and peace back to the city.

Students need to make up years of missed K-12 and university education, and ISIS indoctrination needs to be undone.

During the 2 1/2-year reign of ISIS in Mosul, the ISIS curriculum removed history, geography, literature and art from the classroom. It introduced jihad education for children as young as age 6 and illustrated textbooks with pictures of children wielding weapons. Arithmetic word problems asked students to calculate the number of explosives a factory could produce or how many people a suicide bomb could kill.

Public schooling had been free, but ISIS started charging tuition—$10 to $20 a month, depending on the grade level.

That’s a lot of money in Iraq.

Concerned about the costs and the “lessons” being imparted in the classroom, many parents stopped sending children to school.

Under ISIS, school attendance dropped precipitously. In Mosul and other areas once occupied by ISIS, a million Iraqi school children didn’t go to school or were taught the ISIS curriculum.

On a recent visit to a camp that sheltered those who fled the battle to retake East Mosul, just 20 miles from the city, I interviewed several aid workers who spoke of children being traumatized, indoctrinated or both.

They described a child with recurring nightmares who had been forced by an ISIS fighter to witness a beheading and spoke of children wandering about the camps innocently singing pro-ISIS songs learned in school.

ISIS also indirectly damaged K-12 education in Iraq. When residents fled Mosul, tens of thousands were temporarily housed in school buildings in other parts of Iraq, which further disrupted education in those communities since it prevented classes from being held.

ISIS shut down Mosul’s three universities, including Mosul University, known for its medical school and once considered one of the finest in the Middle East.

ISIS later reopened the university’s departments of medicine and engineering, but kept shuttered departments that might challenge its ideology, such as philosophy and history. Professors with alleged ties to the west were executed, while others fled.

Eventually, ISIS turned some of the university’s buildings into weapons factories and barracks for its fighters.

Coalition fighters have retaken Mosul University, in the eastern region of the city, from ISIS. But the campus has been destroyed by bombs during the battle and by ISIS fighters who torched its buildings, including the library that held many rare and important works. ISIS left behind calling cards in the form of booby traps.

A Mosul University engineering student who fled in 2014 told me she would never go back. She had been finishing up her degree at the university’s temporary campus that faculty set up in the nearby city of Erbil. Like many in the country, she said she fears for her safety and does not see a future for herself in Iraq. Her goal is to leave the country.

Yet there are signs of hope. After East Mosul was retaken last month, 30 schools reopened and another 40 were being checked for safety. Together, they can accommodate 40,000 children.

Winning the military battle in Mosul and other parts of Iraq is only the beginning. Reversing the damage to K-12 and university education will require significant investment and effort. Taking care of the remaining population and helping them recover will be critical—and an education strategy will be central to that.

Based on my recent fieldwork in Iraq and related studies on education in Iraq and education of refugees, rebuilding the educational system in Mosul will require a number of steps that go beyond reopening and staffing schools.

Classrooms will need to be set up specifically for children who have missed several years of school so that they can start where they left off and catch up.

Mosul will need policies to help its children move past the years under ISIS, requiring an undoing of the indoctrination efforts through courses that teach human rights and tolerance for Iraq’s diversity. And teachers will need training in how to deal with traumatized students.

The U.S. has invested significant funding in the military operation against ISIS. But keeping the peace in the long-run will require creating conditions in which Iraqis can live normal lives. Investing in such an education plan should be a U.S. priority.

Public education can serve as a bridge to normalcy in Iraq. It also can help reduce sectarian tensions, provide children and youth the citizenship and professional skills needed for a fully functioning society, and help a generation manage the lingering trauma of war.