The Islamic State (IS) group has said it was behind a high-profile attack on a central prison in the eastern Afghan city of Jalalabad that saw hundreds of prisoners try to flee.
The attack began on Sunday evening when car bombs were detonated at the prison’s entrance by gunmen.
It continued through the night and into Monday morning, with the IS militants battling security forces.
At least 21 people were killed, said a spokesman for Nangarhar province.
According to Attaullah Khogyani, 43 people were injured and taken to a regional hospital. He said three attackers had been killed but others were continuing to resist security forces from the top floor of a residential building.
The prison holds more than 1,700 inmates – most of them Taliban and IS fighters, a security source told news agency AFP.
It was not immediately clear if the attack had been staged to free specific prisoners from the complex.
The attack happened on the third and final day of a temporary ceasefire between the Afghan government and the Taliban, with hundreds of Taliban prisoners released in an effort to get peace talks moving between the two sides.
The Taliban – which is a staunch rival of IS – had earlier said it was not responsible for the attack.