A Senate committee is aiming to close a legal loophole that a newly declassified watchdog report says was used in the past by the Defense Department to fund Afghan security forces accused of gross human rights violations.

The Special Inspector General for Afghanistan Reconstruction report released Tuesday found that in 2015 the department used the loophole to continue support of a dozen Afghan units that had been implicated in 14 human rights violations two years earlier.

A U.S. law named after Sen. Patrick Leahy, D-Vt., the top Democrat on the Senate Appropriations Committee, specifically bars assistance to foreign security forces that commit such abuses. But SIGAR found the Defense Department interpreted a clause in the law to allow exemptions if dropping support of Afghan units put U.S. forces or the mission in Afghanistan at risk.

Leahy called the findings “inexcusable” on Tuesday. The committee wrote in proposed 2018 defense funding legislation unveiled in November that they were “surprised and troubled” by the findings in the then-classified report.

“Given the daily sacrifices of our troops, the purpose of the law is to shield them from associating with such criminals, and to encourage our Afghan partners to act to prevent such abuses and to punish those responsible,” Leahy told the Washington Examiner in a emailed statement.

The Appropriations Committee has cut the clause used by the Defense Department to exempt the units from its proposed 2018 defense funding bill. The committee wrote in an explanatory statement that it expects the military to notify Congress and seek a special waiver before funding any groups accused of abuses.

The fate of the legislation remains uncertain and is tied up in the political wrangling over the budget and immigration that shut down the government over the weekend. Lawmakers are still negotiating a bill to fund the military for the current fiscal year.

A final version of the bill has not been negotiated with Republicans and may include more limited authority for the military but also require some congressional notification, according to Leahy's staff.

The Defense Department has also opposed the change and challenged the criticism, saying it needs flexibility to balance the law with national security and protecting U.S. forces.

The SIGAR “report does not fully convey the unique and difficult challenges of implementing the Leahy law in Afghanistan consistent with both the U.S. commitment to human rights and U.S. national security objectives in Afghanistan,” Jedidiah Royal, the acting deputy assistant secretary of defense for Afghanistan, Pakistan and Central Asia, wrote in a response to the special inspector general’s draft report in May.

“In particular, the draft report does not reflect an understanding of the challenges faced by U.S. forces in Afghanistan in developing and sustaining the Afghan National Defense and Security Forces,” Royal wrote.

The investigation was requested by 93 members of Congress in 2015 following a New York Times story claiming the sexual abuse of boys by U.S.-backed Afghan forces was rampant and that troops were told to look the other way. The Times quoted a father who said his deployed son could hear victims screaming at night on his military base in Afghanistan.

The sexual exploitation of boys by Afghan commanders has long been a concern and even has a name in Afghanistan, bacha bazi, which means “boy play.”

None of the Afghan units funded by the Defense Department were accused of sexually assaulting children, SIGAR reported.

The department tracked a total of 75 incidents of gross human rights violations between 2010 and 2016, the investigation found. Of those, seven involved child sexual assault. A separate investigation by the department’s inspector general released in November found 16 allegations of assault reported during that period, but noted that it could not be sure of that figure because of inconsistent Defense Department reporting.

It allowed the commander of U.S. Forces-Afghanistan to petition for continued support of Afghan units implicated in abuses if withholding the assistance would put at risk U.S. or coalition forces, undermine the mission or national security objectives, or reveal intelligence sources and methods, according to SIGAR.

Despite the New York Times story, the SIGAR investigation found the actual scope of child sex abuse by Afghan forces was unknown and no evidence that the U.S. military had turned a blind eye to abuses.

“Given the seriousness of such an allegation SIGAR’s review makes an important contribution to determining the veracity of such claims,” Royal wrote. “Indeed, the report acknowledges that there is no evidence DOD condones gross violations of human rights by Afghan Security Forces or provided guidance telling service members to ignore any instances.”