KABUL, Afghanistan (AP) — A suicide car bomber struck outside the Supreme Court in the Afghan capital on Tuesday, killing at least 17 people and wounding 39 in the second consecutive day of militant attacks in the heart of Kabul.

The Taliban claimed responsibility for the attack, saying their fighter had taken down judges who obey Western powers.

President Hamid Karzai condemned the bombing, saying it was another "terrorist act that once again shows the Taliban are serving the enemies of Islam."

The bombing was the deadliest attack in Kabul since Dec. 6, 2011, when a suicide bomber on foot hit worshippers at a Shiite shrine, killing at least 80 people.

Tuesday's explosion struck as court employees were leaving the building by the back entrance after the day's work, mostly in buses or private cars, said police officer Jahn Agha.

Police spokesman Hashmat Stanikzai said the bomber drove an SUV and specifically targeted the buses with court workers. Police said all the victims were civilians or court staff.

The courthouse is on a busy main road in central Kabul, near the U.S. Embassy. The NATO headquarters is also nearby.

Taliban spokesman Zabiullah Mujahid claimed responsibility for the attack, saying in a statement the militants were obliged to attack "cruel judges" who do the bidding of foreign powers.

The Taliban and other groups have unleashed a wave of bombings and assassinations around the country, testing the ability of the Afghan security forces to respond with reduced help from international troops, which have begun a withdrawal that will see most foreign troops gone by the end of 2014.

The Taliban have said they would go after government workers as part of their spring campaign targeting those serving the "puppet" administration of Karzai.

"The Islamic Emirate of Afghanistan was obligated to act against this puppet regime because the people have suffered under the courts," said Mujahid, referring to the Taliban by the name they were known when they ruled Afghanistan.

On Monday, seven Taliban fighters with rocket-propelled grenades and machine guns launched a rare assault on NATO's operational headquarters at the military section of Kabul's international airport. All seven militants were killed and two civilians were wounded in the violence.

The failed attack showed that despite an enormous security blanket around the capital, insurgents can still menace Kabul.

Earlier Tuesday, the U.N. in Afghanistan expressed concern over what the mission said was a surge in civilian casualties in the first six months of the year.

Jan Kubis, the U.N. special representative to Afghanistan, said 3,092 civilians were killed or wounded from January to June. That represented a 24 percent increase in the first six months of 2013, compared to the same period last year, he said.

However, Kubis refused to provide a full breakdown of the dead and wounded, saying those figures would be released in July. That made it unclear if what had increased were the number of dead or the number of wounded.

Kubis blamed the increase on the insurgency, saying it was trying to take advantage of the withdrawal of foreign troops in Afghanistan to increase their attacks.

"Because of their campaign, civilian casualties have increased and the situation has worsened," Kubis said.

In 2012, civilian deaths declined to 2,754, a 12 percent decrease from 3,131 in the same period a year earlier. It was the first time in six years that the civilian death toll dropped.

Kubis said the insurgency is to blame for 74 percent of all civilians casualties in the first six months and attributed the rise on the militants "continuing disregard" for international laws on civilians in conflict. He said pro-government forces were to blame for 9 percent of the casualties, but did not say who was responsible for the rest.

He also said that targeting government officials and civilians was a crime under international law. The Taliban have argued that government officials and workers are legitimate targets.

Kubis added that the U.N. in Afghanistan had publicly and privately sent a message to the Taliban that the mission as "willing to discuss civilian casualties and how to reduce them."

The Taliban, Kubis said, had sent "signals of their willingness to discuss this," but that a way to establish contact with the group had not yet been worked out.

Another worrying trend, Kubis said, was the targeting of humanitarian groups.

On May 29, insurgents attacked a compound housing the International Committee of the Red Cross in eastern Afghanistan and killed one of the group's Afghan staff. Five days before, six suicide bombers attacked the offices of the U.N.-affiliated International Organization for Migration in Kabul. During the attack, three Afghans died before security forces killed the insurgents.

"Any attack on humantarians is an attack on civilians," Kubis said.

In another attack on Tuesday, two police officers and two truck drivers were killed when insurgents attacked a convoy carrying cargo through the eastern province of Ghazni. Deputy police chief Asadullah Insafi said three insurgents were also killed in the attack.