Kyrgyz President Sooronbay Jeenbekov resigned on Thursday, saying he wanted to bring an end to the crisis sparked by disputed parliamentary elections earlier this month and avoid any further bloodshed.

Protests had erupted after the October 4 election was won by parties loyal to Jeenbekov, with opponents disputing the results, alleging vote-buying. The vote was later annulled but this did not quell the tensions.

“I am not clinging to power. I do not want to go down in the history of Kyrgyzstan as a president who allowed bloodshed and shooting on its people. I have taken the decision to resign,” Jeenbekov said in a statement released by his office.

More than 1,200 people were injured and one killed during the post-election clashes between protesters and police.

During the unrest, protesters met little resistance as they sprang prominent figures from jail, including populist figurehead Sadyr Japarov.

Former president Almazbek Atambayev – a former Jeenbekov ally turned sworn enemy – was also released, but was later returned to prison. Two of his closest allies remain at large.

Japarov had been serving jail time for hostage-taking, but was named prime minister soon after his release.

In a growing power struggle, Japarov’s supporters had gathered once more on Thursday to demand Jeenbekov’s immediate resignation.

“The current situation is close to a two-sided conflict. On the one hand, the protesters, on the other, the law enforcement agencies,” Jeenbekov said in the statement.

“Military personnel and law enforcement agencies are obliged to use weapons to protect the residence of head of state. In this case, blood will be shed. It is inevitable. I urge both sides not to succumb to provocations.”

The president had on Wednesday finally affirmed Japarov as prime minister, in a move seen as the first step towards calming the crisis.

Jeenbekov had previously pledged to resign after overseeing fresh parliamentary elections in the country. But Japarov insisted that the president should step down without delay.

Jeenbekov called on Japarov and other politicians “to withdraw their supporters from the capital of the country so the people of Bishkek [can] return to a peaceful life” as he resigned on Thursday.

The election of a new parliamentary speaker had appeared to bolster Jeenbekov’s position.

Kanat Isayev, whose party has been supportive of Jeenbekov, called on the president to stay in office on Thursday. Isayev should now become acting president according to the constitution.

But his position was also uncertain on Thursday as a group of hundreds of Japarov supporters gathered at a disused hotel a few hundred metres from the presidential residence and called for him to step down along with Jeenbekov, an AFP correspondent saw.

Japarov’s supporters have called for the populist to become president since the crisis began. The prime minister becomes acting president in the event that parliament is without a speaker.

His emergence as a key player in the chaos that followed the protest against vote results was seen as driving factor behind a rally against organised crime led by civic groups last Friday.

Japarov has denied links to organised crime and said that his arrest on hostage-taking charges in 2017 was the result of a “political order”.