Three patients died when hundreds of lawyers attacked a hospital in Lahore during a furious dispute with doctors.
Video showed the lawyers ransacking wards at the cardiac hospital, beating up staff and smashing equipment.
As panic spread, doctors and paramedics hid, leaving patients unattended, including those in a critical state.
Riot police fired tear gas to disperse the lawyers and more than 20 arrests were made. It took more than two hours to restore order, officials said.
The lawyers had been protesting over the alleged mistreatment of some of their colleagues by hospital staff last month.
But the final trigger for the violence appears to have been a video posted on social media by a doctor on Tuesday night in which he poked fun at the lawyers.
How did the attack unfold?
According to hospital administrators, more than 200 lawyers wielding sticks stormed Lahore's Punjab Institute of Cardiology (PIC) at midday on Wednesday.
Hospital officials said the lawyers forced their way past security and split into groups, attacking various departments and wards.
Video footage shared on social media showed lawyers - in suits and ties - smashing medical equipment and windows, and beating up staff and officials including Punjab information minister Fayazul Hasan Chauhan who had arrived on the scene to try to restore calm.
They also stormed the nurses' hostel, breaking furniture and beating some of the staff, an official complaint from the hospital says.
Lawyers also damaged several cars parked outside the hospital and set at least one police van on fire.
Some of the protesters allegedly fired gunshots in the air when riot police intervened.
Hospital sources said at least three patients - a woman and two men - died because doctors could not attend to them during the violence. It is believed that the woman had been in the intensive care unit.
Police reinforcements were eventually deployed, leading to more scuffles in which several lawyers were injured.
Officers said later they had arrested more than 20 lawyers and filed complaints against about 250 on charges of violence and assault.
What led up to the violence?
There has been simmering anger among young lawyers since 20 November when half a dozen of them accompanied a colleague to the hospital for the treatment of his sick mother, says the BBC's M Ilyas Khan in Islamabad.
There they got into an argument with hospital staff and a doctor on duty, leading to a fierce fist fight in which the lawyers were outnumbered by the hospital staff.
Both sides filed police complaints against each other but no arrests were made.
But tempers ran high, and both sides got their respective professional associations involved to bring pressure on the police to arrest members of the opposing party.
This forced the provincial authorities to intervene and an agreement was reached on Tuesday under which the hospital staff agreed to apologise to the lawyers while the lawyers agreed to withdraw their complaint.
But at that moment, the video of a young doctor bragging about how the lawyers involved in the 2 November episode had been humiliated was posted on social media and went viral, our correspondent adds.
An angry meeting of the lawyers took place at the bar council's office on Wednesday morning, where many of them decided to march on the hospital about 3km (two miles) away.
Footage on social media shows a lawyer walking ahead of his marching colleagues and addressing the doctor in the earlier video, inviting him to see the "sea" of lawyers heading towards him.
What has the reaction been in Pakistan?
The lawyers who took part in the attack on the hospital have been widely criticised in Pakistani media.
"Pakistanis have been witnesses to violent acts by lawyers for several years now," commented one television anchor on Geo TV on Thursday.
"They have assaulted citizens, attacked policemen, raised their hands on judges and vandalised courts. But yesterday they crossed all limits," she added.
Other commentators said it was a new low for Pakistani society's sinking levels of tolerance which is giving way to mob justice.
Our correspondent says the state's failure to deliver social justice lies in the rise of interest groups within political, judicial and economic circles who are protected by the country's powerful establishment.
Afrasiab Khattak, a former chairman of the independent Human Rights Commission of Pakistan (HRCP), tweeted that Pakistan was "caught in a vicious cycle of anarchy and militaristic regimentation".
He added: "Trampling of the constitution, rise of militarisation and lack of tolerance create anarchy, and a typical state response is the deployment of [paramilitary] rangers."
After the lawyers called for a strike across Punjab on Thursday, the provincial government has asked for the deployment of rangers at all public offices, including offices of senior police officials.