Shots were fired at the Pakistani embassy in Afghanistan's capital on Friday in what Prime Minister Shehbaz Sharif called a "dastardly assassination attempt" on the head of the mission.
Ubaid-ur-Rehman Nizamani arrived last month to take up the position at one of the few embassies to stay operational after the Taliban took over the country in August 2021.
Although Pakistan does not officially recognise Afghanistan's Taliban government, it kept its embassy open even as the hardline Islamists took power in August last year, and maintains a full diplomatic mission.
An embassy official told AFP a lone attacker "came behind the cover of houses and started firing".
"The ambassador and all the other staff are safe, but we are not going outside the embassy building as a precaution," he said.
Mr Sharif said the security guard saved Mr Nizamani's life by diving in front of the gun.
A spokesman for Afghanistan's foreign ministry said they strongly condemned the "failed attack".
"The Islamic Emirate of Afghanistan will not allow any malicious actors to pose a threat to the security of diplomatic missions in Kabul," it said in a statement.
Two people were injured in another attack in Kabul on Friday afternoon near the office of the Hezb-e-Islami party associated with former Afghan prime minister Gulbuddin Hekmatyar.
It was not immediately clear who was responsible for the two attacks, which come just days after Pakistan's Minister of State for Foreign Affairs led a team to Kabul to meet Taliban authorities with a view to easing tensions along the border between the two countries.
The attack occurred at a time of heightened security concerns in areas bordering Afghanistan after the Pakistani Taliban (TTP) on Monday said it would no longer abide by a months-long ceasefire with the Pakistan government.
The TTP launched a suicide attack on a police patrol in Quetta on Wednesday, killing four and injuring 20.