Pakistan's authorities have struck a deal with a hard-line Islamist party to end a protest over the acquittal of a Christian woman convicted of blasphemy.
As part of the deal, proceedings will begin to bar Asia Bibi from leaving the country.
The government will also not prevent protesters legally challenging the Supreme Court decision to release her.
Asia Bibi was convicted in 2010 of insulting the Prophet Muhammad, but was acquitted earlier this week.
The ruling enraged some in the majority-Muslim country.
Hardliners who support Pakistan's blasphemy laws have been taking to the streets since Wednesday's ruling.
Pakistani Information Minister Fawad Chaudhry told the BBC, “We had two options: either to use force, and when you use force people can be killed. That is not something a state should do… We tried negotiations and (in) negotiations you take something and you leave something.”
He defended the agreement against allegations the government was capitulating to extremists:
“We need to take steps against extremism, we need to take steps against such kind of violent protesters and we need to come up with a permanent solution. Right now this is not a cure. This is firefighting, what we are doing. The cure is the real thing and our government is committed to the cure.”
He clarified that the decision on whether or not to bar Asia Bibi from leaving the country would be made by a court, and added the government would “take all steps necessary” to ensure Asia Bibi's safety.
What's in the deal?
It was reached between the government and the Tehreek-i-Labaik (TLP) party, which led the mass protests, local media report.
Under the agreement, as well as beginning legal proceedings to put Asia Bibi on a list which would ban her from leaving Pakistan, the government will also not block a review petition filed against the verdict.
The deal also envisages that all protesters arrested since Asia Bibi's acquittal will be released, and any violence towards them will be investigated.
In return, the TLP is asking its supporters to stop the protests and disperse peacefully.
The authorities earlier said that Asia Bibi was scheduled for release later this week.
Speaking to the BBC this week, her lawyer Saiful Mulook said she would need to move to a Western country for her own safety. Several countries have offered her asylum.
What was Asia Bibi accused of?
The trial stems from an argument Asia Bibi, whose full name is Asia Noreen, had with a group of women in June 2009.
They were harvesting fruit when a row broke out about a bucket of water. The women said that because she had used a cup, they could no longer touch it, as her faith had made it unclean.
[A man holds a photo of Asia Bibi during a protest in Islamabad, Pakistan. Photo: 2 November 2018] Image copyrightAFP/GETTY IMAGES
Image captionThere is widespread support for severe punishments for blasphemers in Pakistan
Prosecutors alleged that in the row which followed, the women said Asia Bibi should convert to Islam and that she made offensive comments about the Prophet Muhammad in response.
She was later beaten up at her home, during which her accusers say she confessed to blasphemy. She was arrested after a police investigation.
On Wednesday though the Supreme Court acquitted her, saying that the case was based on flimsy evidence and her confession was delivered in front of a crowd “threatening to kill her”.
Meanwhile in an interview with a German broadcaster Asia Bibi's husband has pleaded for asylum from the UK, US or Canada.
Asia Bibi's husband, Ashiq Masih, said they were in great danger in Pakistan.
The Supreme Court overturned her conviction on Wednesday, saying the case against her was based on flimsy evidence. But she has yet to be freed.
Her acquittal sparked violent protests, and the government has now agreed to try to stop her leaving the country.
On Saturday, her lawyer, Saif Mulook, fled Pakistan, saying he feared for his life.
An Australian with deep connections to Pakistan told Anglican Aid that while Asia Bibi was in prison she would be safe but if she is released without being deported her life is likely in danger.
Source BBC World News
Related project: Miracle School (Anti-Slavery and Education)