PESHAWAR, Pakistan — The brazen killing of an American standing trial for blasphemy in Pakistan has sparked renewed pressure on Islamabad to reform controversial laws that human rights groups say target minorities.

Tahir Naseem, 57, of Illinois was on trial in the Pakistani city of Peshawar for claiming to be a prophet. Early Wednesday, a man walked into the city’s busy central courtroom and shot Naseem multiple times at close range.

Video of the killing, widely circulated on social media, showed police restraining the gunman as Naseem lay in a pool of blood on the floor just a few feet away. The man could be heard saying that the prophet Muhammad told him to kill Naseem in a dream.

“He is the enemy of Islam . . . the enemy of Pakistan,” the gunman said.

Inam Ullah Yousafzai, a lawyer who was in the courtroom, said that after killing Naseem, the gunman placed his pistol on a table and surrendered to police. Another lawyer present at the court remarked on how difficult it would be to bring a weapon into the building. The courthouse is heavily guarded, with multiple security searches and checkpoints that anyone who wants to enter must pass through.

The suspect was brought before a court to face possible terrorism and murder charges Thursday.

The Pakistani Foreign Ministry said in a statement that “the alleged killer has been arrested and a special team constituted to investigate the case.” It pledged that “the matter will be dealt with in accordance with the law” and that constitutional rights and protections would be “fully enforced and implemented.”

A police report identified the suspect only as Faisal, son of Abdullah, and a resident of Peshawar’s Gulabad neighborhood.

The U.S. State Department said Naseem was a U.S. citizen and called in a tweet for “immediate action” in response to his killing.

Cale Brown, a State Department spokesman, said the United States had worked with Naseem’s family since his detention in 2018 and alerted senior Pakistani officials to his case “to prevent the type of shameful tragedy that eventually occurred,” according to a statement. Brown said Pakistan’s blasphemy laws are often abused and demanded that they be reformed.

Pakistan’s blasphemy laws have long been the target of fierce criticism from international human rights groups, which have demanded their repeal. Human Rights Watch has reported that the laws “provide a pretext for violence against religious minorities, as well as arbitrary arrests and prosecution.”

Anyone found guilty of insulting Islam can be sentenced to death, and allegations of blasphemy have triggered violent riots. Blasphemy allegations have led to extrajudicial murders, rights groups say. But while many inmates are on death row for blasphemy in Pakistan, the country has never carried out a death sentence in those cases.

Most of those accused of blasphemy, like Naseem, belong to the Ahmadia minority group, which is viewed by many Muslims in Pakistan as heretical.

Hours after the news of Naseem’s killing was reported by local media, a hashtag began trending on social media praising the gunman as a hero. Many of those promoting the hashtag described themselves as Taliban sympathizers.

A relative of Naseem’s ex-wife in Pakistan said that when he was living outside Peshawar, he survived multiple Taliban assassination attempts.

The relative, Amjad Ali, said Naseem’s beliefs quickly became controversial in the small village he lived in before he moved to the United States. Naseem’s wife divorced him in 2008 shortly after their marriage, and Naseem’s relatives began receiving death threats, ultimately forcing them to sell their possessions and leave, according to Ali.

“Now he has no one in the village,” Ali said.

In one of Pakistan’s most recent high-profile blasphemy cases, an illiterate woman, Asia Bibi, was charged and imprisoned on death row for eight years before she was acquitted and eventually sought asylum in Canada last year. Her release sparked violent riots, and she continued to receive death threats from Islamist extremists even after fleeing to Canada.

George reported from Kabul.