KABUL — Apparent Taliban bombers struck some of Afghanistan’s most heavily guarded sites Tuesday, setting off twin blasts outside security agencies in the Afghan capital and targeting a VIP compound in southern Afghanistan. More than 30 people were killed and scores wounded, including the ambassador from the United Arab Emirates.

The attacks marked one of the bloodiest days in Afghanistan in months. It also again showed the insurgents’ ability to penetrate Afghan security and deal another blow to government claims that its U.S.-aided forces are gaining the upper hand against the Taliban.

In Kabul, a suicide attacker approached an intelligence agency building in Kabul before detonating explosives, said Kabul police spokesman Basir Mujhaid. A car bomb then exploded as security forces gathered at the site of the first blast, Mujahid said.

Hours later, an explosion took place outside the governor’s compound in the southern city of Kandahar as he met with security officials and the UAE’s ambassador to Afghanistan, Kandahar police officials said.

In Abu Dhabi, a statement by the UAE’s Foreign Ministry said the blast injured Ambassador Mohammed Abdullah al-Kaabi and other UAE diplomats.

The UAE has been closely involved in Afghan affairs for decades. Kandahar’s governor said the talks involved a $2 million “training project.”

The Taliban claimed responsibility for the back-to-back bombings in Kabul. There was no immediate claim of responsibility for the Kandahar attack, but the area is a stronghold for the Taliban.