A Chinese national arrested in Pakistan on charges of blasphemy has been released from a high-security prison after a court granted him bail, a defense lawyer and local police said Friday.

Under Pakistan’s controversial blasphemy laws, which have been widely criticized by rights groups, anyone convicted of the offense can be sentenced to death. Often, just a mere accusation is enough to provoke mobs to riot and even attempt to lynch those suspected of blasphemy.

The suspect, identified only by one name, Tian, was part of a group of Chinese working on the Dasu Dam, the biggest hydropower project in Pakistan. He was accused of blasphemy earlier this month after he criticized two drivers working on the project for taking too much time to pray during work hours.

Hundreds of residents and laborers in the town of Komela then blocked a key highway and demanded his arrest. They alleged that Tian insulted Islam, a charge he denied.

CHINA'S RAILROAD TO WORLD DOMINATION: $58 BILLION RAIL LINK WITH PAKISTAN WILL REDUCE RELIANCE ON WEST

His lawyer, Atif Khan Jadoon, said Tian was granted bail by a judge in the northwestern city of Abbottabad on Thursday. He was released after depositing a bond of $700, Jadoon said.

It was not immediately clear if Tian would have to remain in Pakistan to face trial or if he would be allowed to go back to China. The Chinese Embassy had earlier said it was looking into his case.

Pakistan locator map

A Chinese national was released from a high security prison in Pakistan after being arrested on blasphemy charges. (AP Photo)

During his detention, Tian was briefly hospitalized after feeling unwell, authorities have said but provided no other details. He pleaded not guilty during an earlier appearance in court and insisted he did not insult Islam or the Prophet Muhammad, according to his lawyer.

PAKISTAN BOWS OUT OF US-LED SUMMIT IN POTENTIAL MOVE TO WOO CHINA

The arrest of Muslims and non-Muslims on charges of blasphemy are common in Pakistan, but foreigners are rarely detained. Police at one point said they arrested Tian to save him from an attack by angry crowds.

In 2021, a mob lynched a Sri Lankan man at a sports equipment factory in the eastern Punjab province. The crowd later burned his body in public over allegations that he had desecrated posters bearing the name of the Prophet Muhammad.

In related developments, Pakistani police said Friday that a lawyer from the minority Ahmadi community was arrested for blasphemy in the southern port city of Karachi.

Pakistan declared Ahmadis non-Muslims in 1974. They have since frequently been targeted by Muslim extremists, drawing international condemnation.

CLICK HERE TO GET THE FOX NEWS APP

The detained lawyer, Ali Ahmad Tariq, was arrested on Thursday, allegedly because he had added a Muslim honorific to his name in official documents, prompting a Muslim resident to complain to the police.

The development drew condemnation from human rights groups and Ahmadi community activists. A spokesman for the community, Amir Mehmood, denounced the arrest.