The abuses came even as the United States and others have spent billions of dollars training the police and security services.
The torture was not the result of Afghan government policy, but of individual actions that were mostly ignored by the security services, according to a 74-page UN report.
Afghan security officials have long been suspected of torturing detainees to elicit information and confessions, and the report for the first time confirms the practice and outlines much of the abuse.
It found that detainees in 47 facilities in 24 provinces run by the Afghan National Police and the Directorate of Security suffered interrogation techniques that constituted torture under international and Afghan law.
The NATO-led coalition announced last month that it had stopped transferring detainees to 16 of the facilities. NATO was taking action to help fix the problem before resuming the transfers, the report said.
International organizations and governments have spent years trying to bring good governance and rule of law to Afghanistan, a goal that has taken added significance following a decision to hand over security responsibilities to the Afghan government by the end of 2014, when all foreign combat troops are to leave the country.
According to the UN report, the torture allegations could, under U.S. law, endanger American funding to some of the security services. The United States provides the overwhelming majority of the cash currently flowing into training and mentoring programs.
The report said the torture allegations "could also trigger application" of a 1997 law that bars the U.S. government from providing funding, weapons or training to any unit of the security forces of a country if the U.S. secretary of state determines there is credible evidence that it "has committed gross human rights violations."
The law would not be applied, however, if the United States determined that action was being taken to solve the problem. One such step, it said, would include bringing to justice "those officials responsible for torture and ill treatment."