A group of people at a village Muzaffarnagar set two men free from police custody and locked up the team of security personnel who arrested the duo in connection with a case, police said on Saturday.
However, another police team soon reached the spot on Friday and rescued their confined colleagues, they said.
Following the incident, police arrested five people and registered cases against as many as 33 people of the village charging them with forcibly freeing the accused from the police custody at Singra village in the district, Deputy SP Alok Priyadarshi said.
A police team had picked two accused -- Daryao Singh and Jagbir -- in connection with the case on Friday.
The villagers opposed the policemen and locked them up in a room after setting the duo free from the police custody, Priyadarshi said.
Meanwhile, security has been tightened in the village to avoid any untoward incident, he added.