An Afghan security guard was killed on Friday when a United Nations compound came under attack in Herat, officials said,…