Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The independent U.S. watchdog for Afghanistan aid is out with a new report pointing to significant problems in the education sector, once thought to be one of the few bright spots in the faltering multi-billion-dollar American reconstruction effort.

The report, by John Sopko, the Special Inspector General for Afghanistan Reconstruction, says that after visiting 25 schools in Herat province, auditors found crumbling school buildings and big discrepancies in student and teacher attendance.

The $868 million the U.S. has spent attempting to rebuild Afghanistan’s education system investment may be at risk, Sopko concluded, in the latest of a series of downbeat reports that collectively raise questions about the 15-year-long American rebuilding project in Afghanistan.

"We could lose it all and all the investment for the last 15 years if we don't get it right."

The U.S. has spent more on Afghan reconstruction in real dollars than it did rebuilding Europe under the Marshall Plan after World War II, Sopko has said -- with much different results. The modest gains in Afghan living standards that have resulted from all that spending could easily plummet amid a deteriorating security situation and endemic corruption, he says.

"We could lose it all and all the investment for the last 15 years if we don't get it right as we go forward," Sopko told NBC News recently.

On the military side, the Taliban controls more of Afghanistan than it has at any time since the start of the war in 2001, American officials acknowledge.

In another recent report, Sopko found that after $3 billion in U.S. spending on Afghan roads, 95 percent of the sections his auditors inspected were damaged or destroyed, and 85 percent were maintained poorly or not at all.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

In the Herat schools, Sopko says his auditors found a substantial disconnect between the number of students and teachers paid for on the books, and the number who actually attended. Each student or teacher on the rolls is funded by the Afghan government, which in turn is funded by international donors, the largest of which is the U.S.

While officials reported an average enrollment of 2,639 students at each of the 25 schools in Herat province, an average of 561 students were observed at each school, or 23 percent of the reported numbers.

"Our observations from these site visits indicated that there may be problems with student and teacher absenteeism at many of the schools we visited in Herat that warrant further investigation by the Afghan government," Sopko wrote. "We also observed that several schools we visited in Herat lack ... electricity and clean water, and have structural deficiencies that are affecting the delivery of education."

At another school in Herat City, a school official noted that 1,287 students attended the school on a normal day.

"However, we observed that only 9 students were present on school grounds at that time," the report says.

The U.S. Agency for International Development has claimed that its programs to boost the Afghan education sector "have contributed to measurable positive impacts on Afghanistan’s development and stability."

USAID has cited an increased student enrollment from 900,000 students in 2002 to 8 million in 2013 as evidence of overall progress in the sector.

In a written response to the new report, USAID said that a handful of site visits is not enough to substantiate claims of persistently low attendance, and Sopko agreed.

William Hammink, USAID assistant to the administrator for Afghanistan and Pakistan affairs, said in a statement to NBC News: "Millions of children in Afghanistan have had an opportunity to attend school with USAID's support over the past 15 years. The benefits they derive from education will have a lasting, positive impact on their lives."

However, in June 2015, Afghanistan’s Independent Joint Anti-Corruption Monitoring and Evaluation Committee reported that education was being "significantly undermined by bribery and nepotism," and that "ghost" teachers have been a long-standing problem.

Less than half of the Herat schools had reliable electricity, the report found, and two facilities lacked access to a clean source of water.

Additionally, "we found schools that had structural and utility deficiencies that could endanger students, teachers, and other occupants."

"Given that USAID has spent millions of dollars on the construction and rehabilitation of Afghan schools, and continues to spend millions of dollars on teacher training and salaries… the agency has a clear interest in ensuring that the improvements it reports in the Afghan education sector are based on actual attendance, rather than on potentially inflated figures," the report says.

According to the new SIGAR report, in July 2015, Afghan President Ashraf Ghani ordered an investigation into alleged corruption in the education ministry. By January, Afghan media was publishing results of the probe, including "nonexistent 'ghost' schools, teachers and seminars.