Deadly violence has erupted during local elections in Bangladesh, leaving at least 13 people dead this week. Analysts said the mayhem shows the country's democracy is struggling in the face of Islamist extremism and a divisive debate over how to deal with the legacy of its 1971 civil war.

The election violence Tuesday night — including vicious political clashes between rival parties as well as security forces opening fire on rioters — was considered unusual for the impoverished South Asian nation. While attacks have accompanied national elections in the past, village-level polls have usually been peaceful.

But with the two main political parties disagreeing over whether, and how, to punish war crimes committed during the country's war of independence from Pakistan, public discourse has become more extreme, analysts said. Attacks carried out by Islamist extremists have led the secular government of Prime Minister Sheikh Hasina to crack down with an increasingly heavy hand as it aims to reassure the international community about Bangladeshi security.

After polling booths closed Tuesday night in the southern Pirojpur district, a 700-strong mob took a polling officer hostage while trying to snatch ballot boxes, local police superintendent Walid Hossain said.

Security officials including paramilitary border guards opened fire on the mob, under orders from a local magistrate, Hossain said. At least five ruling-party supporters were killed while scores of others were injured, he said.

Local media reported at least six people were killed in violent scuffles elsewhere in the country on Tuesday. The leading Bengali-language daily Prothom Alo reported that two people hurt Tuesday died of their injuries Wednesday, and that another 10 people were killed during campaigning in the month leading up to elections.

Calls seeking comment from Home Minister Asaduzzaman Khan were not returned immediately.

Tuesday's voting was the first of six scheduled election days to fill a total of 4,275 village councils, with the last vote to be held in June. Hasina's party won about 500 of 712 races for council chairmanships, according to unofficial results.

The main opposition Bangladesh Nationalist Party, led by former prime minister Khaleda Zia, filed an official complaint calling the voting "farcical," saying the ruling party stuffed ballot boxes and intimidated voters and opposition candidates. Local media reported incidents of voter intimidation and vote fraud in many areas.

Chief Election Commissioner Kazi Rakibuddin told reporters that the voting was widely acceptable, and that they would look into "stray incidents" of irregularities.

This was the first year that political parties were allowed to campaign under their logos and banners for local elections. Previously, parties were only allowed to offer verbal support for candidates, but the government advocated a paradigm shift, saying election under partisan lines will bolster democracy.

"But this new game plan to consolidate power at the grassroots level has created new tension," government analyst Tofail Ahmed said. He said this week's violence "demonstrates the continuous shrinking of spaces for democratic advancement."

Ahmed suggested Hasina's political success was encouraging her followers to bully the opposition. She won re-election in January 2014, in a vote boycotted by the main opposition and its Islamist partners because Hasina would not step aside to allow a caretaker government to oversee the balloting.

"The opposition has been intimidated, while an intraparty feud within the ruling party has created more chaos and the party will suffer in the long run to fix the confrontation that has now spread to such grassroots levels," Ahmed said.

"Local-level elections were always focused on local context, but this time under partisan lines it has created more confrontation with rival parties and also division within the ruling party. Not a good sign for a healthy democracy," he said.

Another analyst, Badiul Alam Majumdar, said Tuesday's election was "a clear exercise by the ruling party that they have to win at any cost."

"The ruling party talks about democracy but it is actually practicing dictatorship," he said. "Is it an election, fair election? No."

Several leading newspapers on Thursday published editorials condemning the violence and highlighting serious loopholes in the election process.

The leading English-language Daily Star castigated the Election Commission, saying, "We wonder how a responsible authority can be so oblivious to the loss of so many lives and pervasive electoral irregularities. The ruling party also cannot shrug off its responsibilities, as in most cases their party men were found flouting electoral rules."