The Penal Code 1976 provides -
CHAPTER EIGHT: Adultery, Pederasty, and Violations of Honour
(1) A person who commits adultery or pederasty shall be sentenced to long imprisonment.
(2) In one of the following cases commitment of the acts, specified above, is considered to be aggravating conditions:
a. In the case where the person against whom the crime has been committed is not yet eighteen years old.
In Afghan legal terminology "pederasty" appears to refer to homosexual acts and not paedophilia, which instead falls under subsection a) of article 427. Islamic Sharia law, criminalizing homosexual acts with a maximum of death penalty, is applied together with the codified Penal law. However, no known cases of death sentences have been handed out for homosexual acts after the end of Taliban rule [R1.4].
In October 2012, a court in Herat Province convicted a 13-year-old boy on moral crimes charges, and sentenced him to one year in juvenile detention after he was accused of having sex with two adult men in a public park. The men were also arrested and charged with moral crimes, but the outcome of their case is unknown [R1.3].
In October 2007, it has been reported that boys as young as fourteen are being sexually abused by Afghanistan militia leaders in keeping with a tradition where older men purchase the youths to entertain them by dancing at parties. Fear of the armed militia groups has meant the government has not intervened in the practise [R1.2].
In May 1998, Taliban Islamic authorities last month executed two young men who had confessed to having gay sex by crushing them to death when executioners bulldozed a stone wall into them [R1.2].