KABUL, Afghanistan — A bomber wearing a vest packed with explosives struck outside the Afghan Defense Ministry on Saturday, killing at least 10 people in a blast just hours after Chuck Hagel, the new United States defense secretary, arrived here.

And a short time later, another bomber detonated his explosives in eastern Afghanistan before reaching what appeared to be his target, a joint Afghan-American military checkpoint. He killed eight children and a policeman, according to Afghan military and hospital officials.

Although Mr. Hagel was not at the site of either blast, he was not far from the Kabul attack, for which the Taliban claimed responsibility.

The attacks, with a combined death toll of at least 19, appeared to have been timed to coincide with Mr. Hagel’s visit, and a Taliban spokesman said that the Kabul explosion was intended as a message for the defense secretary. The violence in the heavily secured capital and in a more remote area of the country highlighted Afghanistan’s continuing vulnerability after nearly 12 years of international efforts to vanquish the insurgency.