The attack took place at Kachlak which is close to the capital city of the Baluchistan province.
Police officials said the mob attacked the police station demanding that the police hand over a man who they claimed had desecrated the Holy Quran.
"After the man was arrested it was obvious that he was mentally retarded," senior official Mushtaq Khan said.
He said the police tried to pacify the mob but they were in no mood to listen after learning that the man had burnt pages of the holy book.
"In the ensuing clash that took place someone from the mob fired gunshots due to which two children were hit and they were several injuries including wounded policemen," he added.
"The protesters were out of control as they even stoned vehicles and the police," the official said.
The protesters also burnt tyres and blocked the Quetta-Chaman highway.
Mushtaq said that SP Saddar Malik Irshad narrowly escaped while his police guard was wounded in the shooting that was started by someone in the mob.
"They wanted the man to be hanged for blasphemy and demanded the police to hand him over to them for swift justice," the official added.
Police fired tear gas shells and opened fire in self defence, Quetta police chief Qazi Wajid said.
Anti-Terrorism Force (ATF) and the paramilitary Frontier Corps (FC) had to be called in to bring the situation under control.
Doctors said the two children had died from gunshot wounds while around eight policemen were also admitted for treatment to a local hospital with bullet wounds.