A suicide bomber detonated an explosives-packed car outside a gate at the Afghan Supreme Court during the afternoon rush hour Tuesday, killing 17 people and wounding 38, all of them civilians, Afghan officials said.

A suicide bomber detonated an explosives-packed car outside a gate at the Afghan Supreme Court during the afternoon rush hour Tuesday, killing 17 people and wounding 38, all of them civilians, Afghan officials said.

It was the second consecutive day that insurgents staged a significant suicide attack in the capital, and it raised again the question of whether the Afghan government can ensure security from Taliban attackers. On Monday, Taliban attackers laid siege to the military side of the Kabul airport in a failed attack that killed only the seven attackers and caused little damage.

Tuesday’s casualties included women and children, but it was still unclear how many, said a Health Ministry spokesman, Dr. Kaneshaka Turkistani.

The attacker, who was in a Toyota Corolla or similar car, detonated the explosives behind the Supreme Court building near a gate to a parking lot as workers were ending their work day, said Najibullah Danish, deputy spokesman for the Interior Ministry, which oversees the national police.

Some casualties were court workers, others were just passing on the street.

The bomb blast came just hours after the top United Nations official in Afghanistan said that U.N. officials and Taliban leaders are working out the details of a meeting to talk about reducing civilian casualties.

The toll on civilians, a longstanding U.N. concern, is mostly caused by the insurgents.

Jan Kubis, head of the U.N. Mission in Afghanistan, revealed the negotiations during a news conference in which he said civilian casualties in Afghanistan had jumped 24 percent in the first five months of the year compared with the same period in 2012.

Kubis earlier had issued open and back-channel invitations to the Taliban to meet. He said that the insurgents had responded and that talks had begun “quite recently” about how to make such a meeting work.

“As you know, it’s not that simple to have a meeting between the two of us,” he said.

The topics, he said, would include reducing the toll on civilians and the importance of basic human rights and humanitarian law.

The U.N. mission issues regular reports on civilian casualties, and Kubis has long made it a focus.

He said that killing civilians was not only against international law, but cowardly.

“When you have to fight, fight,” he said. “Fight the fighters, don’t kill civilians.”

The Taliban use civilian casualties as a public relations tool. They often report – and often invent or exaggerate – civilian deaths resulting from operations by the NATO-led coalition here, particularly in airstrikes. That, in turn, has raised tensions between the coalition and the Afghan government and led President Hamid Karzai to issue several condemnations. In February, Karzai decreed that government forces could not request foreign air support during operations in residential areas.

But the insurgents are responsible for most civilian casualties, according to U.N. figures. Kubis said that the insurgents were behind 74 percent of such casualties from Jan. 1 to June 6, a figure similar to that in 2012. Pro-government forces were responsible for 9 percent.

In total, 3,092 civilian were killed or wounded in that period, the U.N. mission said. Casualties among children were up 30 percent over 2012, while casualties blamed on improvised bombs jumped 41 percent. Targeted killings were up 42 percent.

The number of civilians killed in airstrikes was one of the few bright spots. Those fell by 30 percent, the U.N. mission said.

Last month, insurgents attacked an office of the International Committee of the Red Cross in the city of Jalalabad, killing a guard and wounding one employee. That was just days after another group of fighters hit a Kabul guest house used by an international refugee agency, injuring several workers and killing a guard and an off-duty police officer.

Such attacks, Kubis said, were essentially attacks on the most vulnerable civilians, those served by these agencies.

The U.N. mission didn’t release the full set of numbers and said it wouldn’t until July, which is the scheduled publication date for its standard six-month report.

The horrific nature of the killings of civilians was underlined not only by the Supreme Court attack, but by the discovery in Kandahar province of the beheaded bodies of two impoverished boys, ages 16 and 11.

“According to tribal elders and residents, the families of these boys were threatened by the Taliban not to use the food they were getting from a police checkpoint nearby, as they were very poor and couldn’t afford food from the local market,” said the spokesman for the provincial government, Javid Faisal. “But despite that they continued receiving food from the police.”

A Taliban spokesman denied the group’s involvement, but Faisal said that there were no other insurgent organizations operating in that area and that the Taliban routinely dodge responsibility for killing civilians.

“It’s a part of their media propaganda,” he said. “As a human being and the provincial spokesman for Kandahar I strongly condemn this inhuman and barbaric act and call it against all principals of Islam.”