A United States citizen on trial for blasphemy in Pakistan has been shot dead while appearing in court, in the latest act of violence connected to the controversial legislation.

Tahir Ahmed Naseem, 47, died on Wednesday in the northwestern city of Peshawar, after a member of the public walked into the courtroom and opened fire in front of the judge, according to officials.

His attacker was arrested at the scene. Naseem was on trial on charges of blasphemy after allegedly claiming to be a prophet, a crime punishable by death or life imprisonment under the Pakistan penal code.

In a statement, the US State Department said officials were “shocked, saddened, and outraged” by Naseem’s death. The statement said that Naseem had been “lured to Pakistan from his home in Illinois by individuals who then used Pakistan’s blasphemy laws to entrap him.” It didn’t offer any further detail.

Naseem had been receiving consular assistance since his arrest in 2018.”We extend our condolences to the family of Tahir Naseem, the American citizen who was killed today inside a courtroom in Pakistan,” the State Department’s Bureau of South and Central Asian Affairs said in a separate statement posted online Thursday. “We urge Pakistan to take immediate action and pursue reforms that will prevent such a shameful tragedy from happening again.”

According to a spokesperson for Peshawar police, the alleged killer told Naseem that he was an “enemy of religion” and deserved to be killed before opening fire. Police are investigating how the suspect was able to enter the court room with a loaded weapon.

Security guards are typically stationed outside court buildings and police officers guard individual court rooms. Guns are difficult to obtain in Pakistan — civilians cannot purchase a weapon or carry one without a valid license. Members of the public are also typically not allowed into local court rooms, such as the one where Naseem was shot.