The apology came after the officer was trolled by Dalits and Ambedkarite social media users.

An IAS officer in Uttar Pradesh has issued a public apology days after he taunted some Dalit leaders of the BSP for their "expensive" attire and cars when they had gone to a primary school to take stock of a case of alleged caste discrimination in the mid-day meals.

Posted as District Magistrate of Ballia, Bhawani Singh Khangorat's apology came after he was trolled by Dalits and Ambedkarite social media users who posted photos of shoes, cars and wrist watches to highlight what they described was his "casteist" outlook.

Stressing that certain reactions on social media had shown "a mirror" to him, Mr. Khangorat admitted to not giving due respect to the BSP activists.

"It was my mistake. It was also childish to refer to somebody's watch, shoes or car. It didn't occur to me then, but now I feel it," said Mr. Khangorat in a statement posted on Twitter.

The controversy dates to August 29 when the DM visited the Rampur-1 primary school in the Purvanchal district to probe if reports of non-Dalit students shunning their Dalit classmates during mid-day meals and also bringing their own plates from home to avoid contact, were true. While the DM dismissed the reports as prima facie baseless, he courted controversy with his remarks targetting a delegation of BSP workers who had reached the school before his team.

Mr. Khangorat had on August 29 said he was "astonished" to find "big cars" parked outside the school when he reached the spot.

"I don't know which party they belonged to. But from their attire they looked like politicians...full-white clothes, expensive shoes and expensive watches. It seemed like they are big, rich-type of people," the DM told reporters after he asked him to comment on BSP chief Mayawati's tweet demanding action over the incident.

Later, a video showed the DM taking a swipe at BSP zonal coordinator Madan Ram for his attire, further fuelling Dalit ire. In the video, Mr. Khangorat can be seen pointing at the BSP leader and saying ,"₹25 lakh ki gadi (car) mein safed posh," before following it up by asking him the cost of his shoes and wrist watch.

The BSP leader countered the DM by saying that he was "making false allegations." The DM then accused the BSP delegation of engaging in "only theatrics."

Visibly put off, the BSP leader exclaimed that an official of the rank of a DM didn't like him wearing shoes costing ₹700. "When the DM's mentality is such, you can imagine the situation," said Mr. Ram.

In his apology note, the DM says he had no idea about the caste or party of the people who had reached the primary school before him and that he found their presence odd.

He also claims he initially did not believe that they were there to actually resolve the issue as they rejected his offer to tag along with him in the probe.

"Whatever it was, it was my mistake to humiliate them that way," the DM said. He also said that since the issue pertained to "innocent children," he found it hard to remain objective. "From the bottom of my heart, with folded hands and my head bowing, I apologise...," he said, if his behaviour was thought to be disrespectful towards any community or group.