Afghan Security personnel arrive outside the Telecommunication Ministry during a gunfight with insurgents in Kabul, Afghanistan, Saturday, April 20, 2019. A suicide blast rocked Afghanistan's capital Saturday during a gun battle with security forces, officials said, killing several people a day after hopes for all-encompassing peace talks collapsed.  (AP Photo/Rahmat Gul)

KABUL, Afghanistan (AP) — The Taliban ambushed a security convoy in western Afghanistan, killing nine policemen, and in Kabul, a would-be attacker died when a bomb he was trying to plant at a private university detonated prematurely, officials said Thursday.

According to a councilman in western Farah province, Abdul Samad Salehi, the ambush took place in Anardara district as the convoy was heading to defuse a roadside bomb on Wednesday afternoon.

Shortly after the attack, other Taliban insurgents targeted and briefly overran the district police headquarters, setting off hours-long clashes, Salehi said. Reinforcements arrived later and managed to wrest back control of the headquarters.

The resurgent Taliban, who have been active in the area and have launched large-scale attacks against Afghan security forces in Farah in the past, did not immediately comment on the attacks.

The insurgents have been staging near-daily attacks across Afghanistan even as they hold talks with a U.S. envoy tasked with finding a peaceful resolution to the 17-year war.

On Thursday in Kabul, a bomb meant to target the private Jahan University blew up apparently prematurely inside a campus bathroom, killing the suspected militant and wounding three students.

Basir Mujahid, spokesman for the Kabul police chief, said the blast took place around 10:30 a.m.

No group immediately claimed responsibility for the explosion but the Taliban and Islamic State militants — who both oppose women's rights to education — have targeted schools and placed of education in the past.

Though the Taliban are holding meetings and negotiating with U.S. peace envoy Zalmay Khalilzad, they refuse to talk directly to the Afghan government.

Talks that were to start last week in Qatar between the Taliban and an array of prominent Afghans, including government officials and opposition representatives, were scuttled after a falling-out between the two sides over who should attend.

Also on Thursday, unidentified gunmen wounded a local reporter in eastern Nangarhar province, said Farid Khan, spokesman for the provincial police chief.

Khan said Emran lemar, a reporter for the Mazal radio station, was shot inside a park in the provincial capital of Jalalabad. He was hospitalized and a police investigation into the attack has begun, Khan said.

In March, Sultan Mahmoud Khirkhowa, a local TV journalist in eastern Khost province, was shot and killed when two men on a motorcycle opened fire on his vehicle. The Islamic State group affiliate claimed the attack in Khost.

Afghanistan is among the most dangerous countries in the world for reporters. The Afghan Journalist Safety Committee reported 121 cases of violence against journalists and media workers in 2018, with 17 killed.