MOSCOW — President Sooronbay Jeenbekov of Kyrgyzstan announced his resignation Thursday, after a former convict gained the upper hand in a power struggle that followed the annulling of parliamentary elections and was appointed prime minister.

Jeenbekov was forced out under pressure from Sadyr Japarov, who emerged as the landlocked Central Asian country’s strongest political figure when he became prime minister Wednesday after an opaque parliamentary vote marred by intimidation and threats of violence.

Allegations of vote buying and fraud over parliamentary elections on Oct. 4 triggered riots, leading to their annulment. Amid the crisis, two jailed opposition leaders were sprung from prison by rampaging supporters, resulting in violent street clashes as each side fought for control.

Japarov, one of the freed leaders, had been serving an 11 1/2-year prison term for kidnapping a regional governor in 2013.

Jeenbekov, who went into hiding as the crisis unfolded, ordered the army into the streets last week in an effort to restore stability.

In recent days, mobs of Japarov’s supporters have assaulted journalists and violently broken up peaceful rallies by those who opposed him.

Last Friday, political leaders, including Japarov’s main rival, former president Almazbek Atambayev, rallied in Ala-Too Square in the capital, Bishkek, but thugs who were armed with sticks and allied to Japarov attacked and dispersed the crowd.

Pistol shots were fired at Atambayev’s car as he left the scene. Atambayev, who like Japarov was freed from prison in the unrest, was rearrested the following day.

Parliament voted to appoint Japarov as prime minister on Saturday, a vote rejected by Jeenbekov because it lacked a quorum.

On Wednesday, Jeenbekov approved a second parliamentary vote backing Japarov but initially resisted pressure to step down, declaring he would remain until new elections are held. He reversed course Thursday, saying he wished to avoid violence.

“Regretfully, the aggression is not over yet, and demands of my immediate resignation are still being made,” he said in a statement released by the presidential media service.

“I do not hold onto power and do not want to go down in Kyrgyzstan’s history as the president who spilled blood and fired at his own citizens. So, I have decided to resign,” Jeenbekov said. He called on Japarov to remove his supporters from the capital and restore peace.

New elections are to be held within three months, the Central Elections Commission said Thursday.

Western diplomats in Kyrgyzstan have expressed alarm at the violent influence of what they describe as organized crime in the political struggle in the Central Asia’s only democracy.

In a strongly worded statement Tuesday, the U.S. Embassy lamented the efforts by organized crime groups to gain political control.

“The United States supports a peaceful and democratic transition in the Kyrgyz Republic. It is clear that one of the obstacles toward democratic progress is the attempt by organized crime groups to exert influence over politics and elections,” the statement said. “This was evident with vote-buying during the October 4 elections, violence and intimidation in Ala-Too Square on October 9, and irregularities in the parliament session on October 10.

“The United States supports the efforts of President Jeenbekov, political leaders, civil society, and legal scholars to return the political life of the country to a constitutional order. Citizens and their leaders must continue to fight against the influence of organized crime and corruption in politics. The ultimate goal must be to uphold the Kyrgyz Constitution and rule of law.”

The European Union also expressed concerns Tuesday about procedural problems in Saturday’s parliamentary vote for the prime minister.

Deputy Speaker Aida Kasymalieva told Kyrgyz parliamentary colleagues on Tuesday that she had received violent threats as the power struggle played out.

“In these past few days, I have found myself left alone confronting representatives of organized crime groups. They threatened to beat and rape me,” she said.