Former PM Nawaz Sharif was disqualified from parliament by the Supreme Court due to failing to declare assets and being untruthful, which violates the Constitution. He was subsequently removed as head of his own party, which is named after him (Pakistan Muslim League - Nawaz). To reinstate him as head of the party, the PMLN pushed a law called Elections Act 2017 through parliament, which allowed people disqualified from parliament to head political parties. However, among various other amendments pertaining to the regulation of elections, the Act also changed the oath parliamentarians have to take. In that oath, those elected to parliament have to declare their complete belief in the fact that Prophet Muhammad (PBUH) is the last prophet. However, the amended oath could be interpreted in such a way that a parliamentarian could believe in someone else as the final prophet. The government called it a "clerical error" , and immediately amended it back to the previous form. That, in my opinion, should've been the end of it. But some fringe religious parties (no one ever heard of them before this controversy) claimed that the amendment of the oath was a conspiracy, and occupied the Faizabad Interchange, which connects Islamabad to Rawalpindi, and is a very busy area. The Metro Bus service, used by 100'000 people daily, was also heavily disrupted. They demanded the resignation of the Law Minister Zahid Hamid, who basically oversees all of the government's legislation. The government obviously refused, but formed a commitee to probe the matter. But the protesters weren't satisfied, and continued the sit-in. Then the Islamabad High Court intervened, and ordered the protesters to be relocated to a ground reserved for protests and rallies, as they were heavily disrupting everyday life. The government didn't want to forcibly remove them, as they were afraid of losing popularity and votes to religious parties, but the High Court issued another order to remove the protesters, and threatened to start contempt of court proceedings against the Interior Minister if he didn't comply. This forced his hand to order an operation to disband the sit-in. Social media and news channels were blocked to try to prevent coverage of the operation and loss of popularity. The operation, however, was botched, as it brought more and more people to the streets, in Lahore and Karachi too. The goverment ordered the deployment of the Army, who, however, encouraged them to find a peaceful solution. The Army apparently negotiated with the leaders of the protest, and convinced the government to accept their demands, which led to the resignation/sacking of the Law Minister, and the end of the protests.
If you ask me my opinion, the Army was behind the protesters all the time, as it is not fond of PMLN at all, having toppled their government in 1999 already, and having had some serious disagreements with them on the subject of fighting terrorism. Their role in ending the protest has made them even more popular, and has undermined the government. The Islamabad High Court's approach worked in the Army's favour, despite being a good one.
When the Army refused to step in, i seriously thought that they were gonna overthrow the government.