Policeman Vikram Pratap Singh was shot dead by the attackers and two undertrials Bagga Singh and Dost Mohammad were freed from the police custody, a senior police official said.
"The goons shot dead police constable Vikram Pratap Singh creating pandemonium in the court premises in the midst of which they escaped with the two accused on their bikes," said Prashant Kumar, Superintendent of Police.
Singh succumbed to the bullet wounds while on way to hospital, the SP said. He belonged to 2001 batch and was a native of Bareilly district.
Several police teams have been formed to nab the accused, the SP said, adding that vital clues have been gathered and the attackers would be identified soon.
