Pakistan's Law Minister Zahid Hamid has tendered his resignation following the deadly clashes across the country between police and protesters belonging to hardline religious groups, the state broadcaster said on Monday.

The protesters had staged a sit-in in the capital for about three weeks demanding the removal of Hamid for changes in a law related to the Khatm-i-Nabuwwat (finality of prohpethood) oath in the Elections Act 2017. They alleged the action undermined Islamic beliefs and linked it to blasphemy.

ALSO READ: Pakistani police battle Islamist hardliners near Islamabad

Hamid, the Minister for Law and Parliamentary Affairs, presented his resignation to Prime Minister Shahid Khaqan Abbasi to bring the country "out of a state of crisis", Radio Pakistan reported.

The resignation came as part of an agreement reached between the government and the protesters overnight. The deal came after a two-day face-off in Islamabad and other parts of the country between protesters and security forces that saw at least six people killed and hundreds injured.