Since the officer was not in uniform, he was identified only hours later when his family called his mobile phone.
Police sources said that Pandith was seen moving around by people near Jamia Masjid in Nowhatta area at 12.30 am.
Pandit was reportedly clicking pictures of the crowd outside the grand mosque to which some people objected. This is the first time such an incident has occurred in the valley.
And while the lynching was going on, the people inside the mosque, oblivious of the incident, were busy in the mandatory nightlong prayers on the occasion of the Lailatul Qadr, the holiest night in the Muslim calendar observed ahead of Eid-ul-Fitr.
Jammu and Kashmir Chief Minister Mehbooba Mufti said the policeman was at the mosque doing his duty. "They killed an innocent, a Tahjud Guzar (one who prays during the nights)", said one of the sisters-in-law of the slain officer.
DGP Vaid said the lynching of the officer had proved that "very little difference is now left in Kashmir between humanity and barbarism".
A police statement said Pandith, a deputy superintendent with the security wing of the state police, had been "attacked and beaten to death by a mob".
The SIT has been constituted for speedy investigation into the murder of the senior police officer.
The curbs under Section 144 preventing the gathering of five or more people at any place were imposed in areas falling under the jurisdiction of Khanyar, Nowhatta, M.R. Gunj, Safakadal and Maisuma police stations, a police officer said. "Pained beyond words at the horrific incident", said Gandhi on his official Twitter account.
Another witness, Adnan Bhat, a journalist, said that only a few people had tried to come to Officer Pandith's defense, and that they had been quickly turned aside.
Over the past year the violence has increasingly drawn in civilians, with young students holding mass protests and whole communities coming out to throw stones at government forces engaged in anti-militant operations. While initial reports suggested that one youth from the mob was shot in the leg and another was shot in his stomach, latest reports say that three people were injured.