Nasim was arrested in 2018 on allegations of blasphemy
The United States on Thursday demanded action over the killing of a US citizen inside a Pakistani court as he faced blasphemy charges, saying it had warned Islamabad about his safety.
The State Department said it was "shocked, saddened and outraged" by the killing of Tahir Ahmad Nasim, a member of the minority Ahmadiyya community who it said was a US citizen who had been lured to Pakistan from his home in Illinois.
Nasim was arrested in 2018 on allegations of blasphemy, a highly inflammatory charge in the conservative Muslim nation that has frequently triggered vigilante violence.
He was being escorted by police on Wednesday to start his trial in the northern city of Peshawar when a man opened fire with a pistol, killing him on the spot, according to officials.
"The US government has been providing consular assistance to Mr Nasim and his family since his detention in 2018 and has called the attention of senior Pakistani officials to his case to prevent the type of shameful tragedy that eventually occurred," State Department spokesman Cale Brown said.
"We urge Pakistan to immediately reform its often abused blasphemy laws and its court system, which allow such abuses to occur, and to ensure that the suspect is prosecuted to the full extent of the law," he said.
The Ahmadiyya have long faced violence in Pakistan, which forbids community members from self-identifying as Muslims.
The sect, which is rooted in the subcontinent and shuns violence, is considered heretical by many orthodox Muslims for challenging the Islamic belief that Mohammed was God's final messenger.
Up to 80 people are known to be imprisoned in Pakistan on blasphemy charges, half of whom face life in prison or the death penalty, according to the US Commission on International Religious Freedom.
The State Department has put Pakistan on a blacklist over religious freedom, pointing to the blasphemy cases.
In one of the most notorious cases, Salman Taseer, the governor of Punjab province, was assassinated in 2011 by one of his bodyguards due to his campaign to reform blasphemy laws.
Taseer had fought to release Asia Bibi, a Pakistani Christian woman facing the death penalty who finally last year was allowed to move to Canada.
In Peshawar, senior police officer Mansur Amaan said authorities were investigating how the attacker managed to get his hands on a firearm inside a courtroom.
He said the assailant may have pulled the gun out of a policeman's holster.