Afghan security forces killed at least 10 Islamic State fighters who had taken control of a prison in the eastern city of Jalalabad, ending a siege in which hundreds of prisoners escaped.
The day before, on Sunday evening, at least 29 people were killed in the militants' assault on the prison and subsequent clashes with security forces, a spokesman for the governor of Nangarhar province said before the final shootout.
"The attack is now over," Sohrab Qaderi, a member of the provincial council, told Reuters after security forces clashed night and day with militants who had taken over the prison watchtowers.
The violence comes at a sensitive time for Afghanistan as the United States attempts to usher peace talks between the Afghan government and the insurgent Taliban, who say they oppose Islamic State and have fought against them.
More than 300 prisoners were still at large, Attaullah Khugyani, spokesman for the governor of Nangarhar province, said. Of the 1793 prisoners, more than 1025 had tried to escape and been recaptured and 430 had remained inside.
"The rest are missing," he said.
A defence ministry statement said all 10 attackers had been killed by Afghan security forces, though a provincial council member and a witness inside the prison told Reuters the number was likely around 30.
Islamic State claimed responsibility for the attack, which came a day after the Afghan intelligence agency said special forces had killed a senior Islamic State commander near Jalalabad, the provincial capital.
After detonating a car bomb at the entrance on Sunday evening, Islamic State gunmen overran the prison where many Islamic State militants captured during a campaign in the past month were being held, along with Taliban fighters and common criminals.
Mohammad Idres, one of the prisoners trapped inside and contacted by cellphone, said on Monday afternoon when the siege was under way he could see could around four bodies on the ground outside.
"We are very hungry, it's very hot and we don't have water," he told Reuters.
"Sometimes it is quiet and then firing starts," he said. "The security forces cannot seem to advance because the attackers hold strategic points, including the watchtowers."
Officials said Afghan Chief of Army Staff Lieutenant General Yasin Zia arrived on Monday to oversee the operation, involving special forces.
Khugyani said civilians, prisoners and members of the security forces were among the 29 dead and more than 50 wounded before the final assault.
As the siege dragged through the day, the normally bustling city was placed under a curfew.
"Jalalabad is completely empty," Qaderi said.
Some 130km east of Kabul, Jalalabad lies on the highway leading to the Khyber Pass and the Pakistani city of Peshawar.
Security forces also clashed with Islamic State fighters on Monday in another part of Nangarhar, according to Ghalib Mujahid, the governor of Behsud district, though he said he did not yet have any information on casualties.
The United States is drawing down troops after almost 19 years of war but security has remained volatile as the Taliban continue attacks on Afghan forces and other targets.
A UN report last month estimated there were around 2200 Islamic State fighters in Afghanistan, and that while the group has lost territory and its leadership has been depleted, it remains capable of carrying out high-profile attacks.
- Reuters