KABUL (Reuters) - An Afghan militia commander arrested over allegations of serious human rights abuses was released on Monday following two days of protests in which dozens of police were wounded, officials said.

Alipur, an anti-Taliban commander from the mainly Shi’ite Hazara minority, was detained in Kabul weeks after an earlier attempt to arrest him in the western province of Ghor ended in a shootout in which at least 12 people were killed.

His arrest set off two days of protests in which dozens of police were wounded by rocks, at least eight security checkpoints and recruiting centers were burned and 19 vehicles damaged, according to the interior ministry.

“A consultation meeting took place today and it was agreed to release him if he guarantees that he won’t break the law again,” said a senior government official, who spoke on condition of anonymity because he was not authorized to talk to the media.

Alipur’s release, as President Ashraf Ghani flew to Geneva to attend a United Nations-sponsored development conference on Afghanistan, was confirmed by the office of Vice President Sarwar Danish.

The decision to let Alipur go underlines the struggle Afghanistan’s Western-backed government has had in reining in politically-connected militia commanders that operate outside its control. It also highlights the risk of fragmentation along ethnic and sectarian lines in Afghanistan, even as hopes have been raised of a possible start to peace talks with the Taliban.

“It is very sad to see people like Alipur bailed out and the government succumbing to pressure,” one security official said.

“It is going to turn into a pattern where even if the security forces arrest a wanted criminal, the government just frees them,” he said. “Security forces will lose faith in the government.”

Alipur, known widely as “Commander Sword”, was accused of serious abuses mainly against ethnic Pashtuns in the Maidan Wardak region, west of Kabul.

However like many other militia strongmen, he has enjoyed high-level political backing that enabled him to defy attempts to arrest him. He also has wide support among Hazaras, many embittered by what they see as government inaction following a string of attacks on Shi’ite targets by the radical Sunni Islamic State group.